Query Database Utility
qdb is a simple perl utility used to run SQL commands on databases. It has been tested with both mysql and oracle databases and it is quite likely that it can be used with other RDBMS without modification. Prerequisites to using it are
In addition to these prerequisites, it is assumed that the database specified by the utility will allow access for the specified user/password with a connection originating from the local host. Its usage is obtained by typing perl qdb.pl.txt and is:
Usage: qdb -d[atabase] value -u[ser] value -s[ql] "sql query" [ -p[ass] value -h[ost] value -x dbtype -t[able] -l[ist] -m[axlines] value -h[elp] ]
"h[ost] value" is optional, default is localhost
"-x dbtype" is optional, default is mysql
" -t[able] -l[ist] -m[axlines] value" are all optional
Example usage:
[localhost]$ perl qdb.pl.txt -d testdb -u testdb -p testdb -h 158.234.96.70 -s "select * from service" -m 2 -t
maximum_preferences;name;system_status;service_id;
10;MO_COPY_SERVICE;1;1;
10;MT_COPY_SERVICE;1;2;
[localhost]$
[localhost]$ perl qdb.pl.txt -d testdb -u testdb -p testdb -h 158.234.96.70 -s "select * from service" -m 2 -l
maximum_preferences: 10
name: MO_COPY_SERVICE
service_id: 1
system_status: 1
-----------------------------
maximum_preferences: 10
name: MT_COPY_SERVICE
service_id: 2
system_status: 1
-----------------------------
[localhost]$