.TH odbcinst 1 "2nd Mar 2002" UnixODBC "UnixODBC Reference" .SH NAME odbcinst \- command line tool for batch ODBC configuration .SH SYNOPSIS .B odbcinst .I action object options .PP .B action is one of .RS .IP -i install a driver or data source .IP -u uninstall a driver or data source .IP -q query a list of drivers or data sources present on the system .IP -j print config info .IP -c call SQLCreateDataSource .IP -m call SQLManageDataSources .IP --version shows the version number of the program .RE .PP .B object is one of .RS .IP -d an ODBC driver in .I /etc/odbcinst.ini .IP -s an ODBC Data Source Name (DSN) in an .I odbc.ini file. .RE .PP .B options are zero or more of .RS .TP .BI "-f " "template file" Used with .BR -i , this option specifies a template file containing the driver or DSN to be installed. .TP .B -r Read the template from standard input. .TP .BI "-n " "Driver/Data Source Name" Used with .B -u to specify a driver or DSN to remove. .TP .B -v Contrary to standard practice, this turns .B off verbose output; there is no output, even for errors. .TP .B -l The specified Data Source object is a System DSN, in .IR /etc/odbc.ini . .TP .B -h The specified Data Source object is a User DSN, in the current user's .IR $HOME/.odbc.ini . This is the default with .BR -s . .RE .SH DESCRIPTION .B odbcinst updates the configuration files that control ODBC access to database servers on the current host. It also maintains in .I /etc/odbcinst.ini a count of the number of references to a particular driver, which can be used to determine whether it should be removed from the file (only when the reference count drops to 0). .SS Installing Drivers and DSNs are installed using the .B -i option. .PP If the object to be installed is a .I driver .RB ( -d ), the specified driver is added to .I /etc/odbcinst.ini or its reference count is incremented if it is already there. .PP If the object is a .I data source .RB ( -s ), the data source is added either to .I /etc/odbc.ini (if .B -l is used) or to .I $HOME/.odbc.ini (the default, which can also be specified with .B -h\fP). .SS Uninstalling Uninstalling a driver is done with the command .B odbcinst -u -d -n .IR " driver name" . Uninstalling a DSN is done with the command .B odbcinst -u -s -n .IR " data source name" . Uninstalling causes the reference count on the object to be decremented. If nothing else has requested this driver or DSN (i.e., the reference count drops to zero), it is removed from the config file. .PP The options .BR -l " and " -h are used with .B -s to specify which .I odbc.ini file to configure. .SS Queries The command .B odbcinst -q -d returns a list of all drivers present in .IR /etc/odbcinst.ini . The command .B odbcinst -q -s returns a list of all system and user DSNs available. .SH EXIT STATUS .TP .B 0 Success .TP .B non-zero Failure .SH TEMPLATE FILES A typical driver template looks like this: .RS [MySQL] Description = MySQL driver Driver = /usr/lib/odbc/libmyodbc.so Setup = /usr/lib/odbc/libodbcmyS.so .RE .PP A DSN template looks like this: .RS [Sample DSN] Description = Test MySQL connection Driver = MySQL Trace = Yes TraceFile = /tmp/odbc.log Database = junk Server = localhost Port = 3306 Socket = .RE .PP The .BR "Description " and " Driver" fields should be present in all DSN configurations. Other options are driver-specific; consult your ODBC driver's documentation for a list of allowed options, or see .B ODBCConfig(1) for a graphical tool that can be used to interactively set up a DSN or driver the first time. .SH FILES .IR /etc/odbcinst.ini ", " /etc/odbc.ini ", " $HOME/.odbc.ini .SH AUTHOR This manual page was written by Oliver Elphick and Steve Langasek for the Debian package of unixODBC. .SH SEE ALSO .BR ODBCConfig(1) ", " gODBCConfig(1)