Installation guide
3. Access Databases using mxODBC
you upgrade an ODBC driver to a newer version, you may have to change all
DSN-less connection setups due to changes in the ODBC driver name.
We recommend to only use DSN-less setups if absolutely necessary or in cases
where access to the ODBC configuration files is otherwise not possible.
DNS-less Connection String
A DNS-less connection provides all configuration information you'd normally place
into the ~/.odbc.ini file, including a textual representation of the driver location
(based on the name used in ~/.odbcinst.ini), e.g.
"Driver={MySQL ODBC 3.51 Driver}; Server=mysql.example.net;
Database=mydb"
Note the curly brackets around the driver name. The name given here must match
the one used in the ~/.odbcinst.ini or
/etc/odbcinst.ini file. The ODBC
manager will then map the name to the registered driver file location.
A
"DSN=mydsn" entry in the connection string is no longer needed.
For a list of common DSN-less connection strings, have a look at the
ConnectionStrings.com
website.
In order to connect to a database using a DSN-less connection string, you simply
pass the string to the
mx.ODBC.Manager.DriverConnect() API.
31