Documentation Home
MySQL Connector/ODBC Developer Guide
Related Documentation Download this Manual
PDF (US Ltr) - 1.7Mb
PDF (A4) - 1.7Mb


MySQL Connector/ODBC Developer Guide  /  Configuring Connector/ODBC  /  Configuring a Connector/ODBC DSN on Unix

5.5 Configuring a Connector/ODBC DSN on Unix

On Unix, you configure DSN entries directly in the odbc.ini file. Here is a typical odbc.ini file that configures myodbc9w (Unicode) and myodbc9a (ANSI) as DSN names for Connector/ODBC 9.2:

Press CTRL+C to copy
; ; odbc.ini configuration for Connector/ODBC 9.2 driver ; [ODBC Data Sources] myodbc9w = MyODBC 9.2 UNICODE Driver DSN myodbc9a = MyODBC 9.2 ANSI Driver DSN [myodbc9w] Driver = /usr/local/lib/libmyodbc9w.so Description = Connector/ODBC 9.2 UNICODE Driver DSN SERVER = localhost PORT = USER = root Password = Database = test OPTION = 3 SOCKET = [myodbc9a] Driver = /usr/local/lib/libmyodbc9a.so Description = Connector/ODBC 9.2 ANSI Driver DSN SERVER = localhost PORT = USER = root Password = Database = test OPTION = 3 SOCKET =

Refer to the Section 5.2, “Connector/ODBC Connection Parameters”, for the list of connection parameters that can be supplied.

Note

If you are using unixODBC, you can use the following tools to set up the DSN:

In some cases when using unixODBC, you might get this error:

Press CTRL+C to copy
Data source name not found and no default driver specified

If this happens, make sure the ODBCINI and ODBCSYSINI environment variables are pointing to the right odbc.ini file. For example, if your odbc.ini file is located in /usr/local/etc, set the environment variables like this:

Press CTRL+C to copy
export ODBCINI=/usr/local/etc/odbc.ini export ODBCSYSINI=/usr/local/etc