Easysoft ODBC-ODBC Bridge

How do I specify connection attributes for my DSN that are not configurable in the odbc.ini?

Last Reviewed:
28th October 2008

My ODBC driver requires additional attributes that I have specified in my odbc.ini file but they do not seem to get through to the driver. The OOB only picks up from the odbc.ini file the attributes specified in the answer to "What attributes may be specified in a DSN?". If you need to specify additional attributes you must pass them in the connection string to SQLDriverConnect().

For Perl, see the answer to the question "How can I put attributes other than the DSN in my Perl DBI->connect call?".

For PHP and OOB there is a simple trick you can use. Add the attributes to string passed to odbc_connect() as the DSN name, separating the attributes with semicolons.

e.g. if you were calling odbc_connect with

odbc_connect("mydsn","username", "password")

and want to pass the ENG attribute with a value of engine use:


This only works with OOB because calls made by applications to SQLConnect in OOB are actually redirected to SQLDriverConnect once "DSN=" is prefixed to the DSN name in SQLConnect's first argument. However, the disadvantage of this method is that if you are using a Driver Manager (e.g. unixODBC) the string passed must be less than 32 (SQL_MAX_DSN_NAME) characters so it is rather limiting (the same does not apply to Perl as Perl calls SQLConnect and if that fails, SQLDriverConnect).

For applications that you have the source code for you will need to edit the code, find the call to SQLDriverConnect and add your attributes to the string argument 3 (InConnectionString). If the application uses SQLConnect instead of SQLDriverConnect (e.g. isql that comes with unixODBC) you will need to change it to use SQLDriverConnect (see the demo.c program in the OOB examples directory for code using SQLDriverConnect).

Applies To

Knowledge Base Feedback

* Did this content help you?
* Please select one option based on your first choice:

(* Required Fields)

Oracle is a registered trademark of Oracle Corporation and/or its affiliates.