1odbx-sql(1) OpenDBX odbx-sql(1)
2
3
4
6 odbx-sql - Swiss army knife for communicating with databases and inter‐
7 active SQL shell
8
10 odbx-sql [-?] [-b backend] [-c configfile] [-d database] [-f delimiter]
11 [-h host] [-i] [-k keywordfile] [-p port] [-s separator] [-u
12 username] [-w]
13
15 odbx-sql is a small and flexible utiltiy to communicate with the data‐
16 bases supported by the OpenDBX library. In batch mode, it's main pur‐
17 pose is automating tasks in shell scripts which require working with
18 databases. On the other side, the interactive mode provides a conve‐
19 nient SQL shell for modifying database content or testing statements.
20 The format of the output can be controlled to some extend by defining
21 strings for separation between columns and for delimiting field values.
22
24 -h, --help
25 Print help including a short description of available options.
26
27 -b, --backend=name
28 Name of the database backend that should be used or path to the
29 backend library of the OpenDBX driver.
30
31 -c, --config=configfile
32 Configuration file with parameters required for connecting to
33 the database. The file can include values for the backend that
34 should be used, the host name or ip address (and maybe the port
35 if required), the database name and the user and password. These
36 values should be placed into the configuration file to be able
37 to access them from non-interactive program execution savely
38 without revealing the password anywhere. A full example of such
39 a configuration file can be found in the example section of this
40 manual.
41
42 -d, --database=name
43 Name of the database on the server or path to the database file
44 in the local file system.
45
46 -f, --delimiter=character
47 Single character or string that should surround field values
48 which are returned by SELECT-like statements and printed to std‐
49 out.
50
51 -h, --host=name
52 Host name, IP address or path to the database file. It can also
53 be the path to a named pipe in order to communicate to the data‐
54 base server only locally.
55
56 -i, --interactive
57 Run in interactive mode and provide a convenient SQL shell con‐
58 trary to batch mode which is waiting for input from stdin and
59 printing results to stdout.
60
61 -k keywordfile
62 Location of a keyword file used for providing auto-completion of
63 keywords.
64
65 -p, --port=port
66 TCP/IP port name or number the database server is listening to.
67 If this parameter isn't added at the command line, most database
68 client libraries use the default value. Many but not all data‐
69 base server can resolve the port number from its name and for a
70 maximum of portability the parameter value should be the port
71 number.
72
73 -s separator
74 Single character or string that should separate field values
75 which are returned by SELECT-like statements and printed to std‐
76 out.
77
78 -u, --username=name
79 Name of the user which is sent to the database server for au‐
80 thentication.
81
82 -w, --password
83 Prompt for a password at the command line.
84
86 Configuration file
87
88 backend = mysql
89 host = localhost
90 port = 3306
91 database = test
92 username = myuser
93 password = secret
94
95
96 Starting in interactive mode
97
98 odbx-sql -c mysql.conf -i
99
100 Executing commands in batch mode
101
102 cat stmt.sql | odbx-sql -c mysql.conf
103
105 odbx-sql returns 1 if an error occured and 0 if all commands succeeded
106 or only warnings are reported. If warnings occur, they are written to
107 stderr.
108
109
110
111 20 July 2023 odbx-sql(1)