[unixODBC-support] SQLConnect and odbc.ini

Thinh Nguyen tnguyen at iii.com
Tue May 3 02:02:30 BST 2005

Hi Nick,

Thanks for your quick response. Because the driver I built always core 
dumped when SQLConnect was called ( and I couldn't figure out why ), I 
have been using an already compiled binary. For sure, it wasn't 
configured to read the same ini file as the unixODBC library I built. So 
that explains it. I'll try again to compile the driver myself to see if 
I'll get lucky this time :)

Thanks a lot,


Nick Gorham wrote:

> Thinh Nguyen wrote:
>> Hi,
>> I have to connect to mySQL server via unixODBC, and SQLConnect() 
>> doesn't seem to honor the parameters set in odbc.ini.
>> I'm wondering:
>> -- why does odbc always connects to the MySQL server run on the 
>> default port on localhost.
>> -- why does it always use the database named "MySQL". Should the DSN 
>> name always be the name of the database we try to use then?
>> -- the only param it seems to care is the "Driver". How do I make it 
>> honor the other params as well? (To get around the problem, I have 
>> been using SQLDriverConnect() instead so I can pass the hostname and 
>> port I wanted to connect to)
>> Thanks a lot in advance for any help.
> All of those are down to the driver to read from the ini file. I would 
> check the driver you hae is built to use unixODBC's libodbcinst.so so 
> it reads the same ini file as unixODBC
>> Thinh
>> This is odbc.ini content:
>> [ODBC Data Sources]
>> MySQL = MySQL ODBC 3.51 Driver DSN
> You don't need that part in a unixODBC ini file, but it doesn't do any 
> harm.
>> [MySQL]
>> Driver       = /dbs/tpp/odbchome/drivers/lib/libmyodbc3.so
>> Description  = MySQL ODBC 3.51 Driver DSN
>> Server       = quality.iii.com
>> Port         =  1032
>> user         =  testapp
>> Password     = testapp
>> Database     = test
>> Option       = 4

More information about the unixODBC-support mailing list