[unixODBC-support] Error using isql - database not bound to DSN?

Gallagher James jgallagher at opendap.org
Thu Aug 30 04:50:22 BST 2012

On Aug 29, 2012, at 2:30 PM, Nick Gorham wrote:

> On 29/08/2012 21:02, Gallagher James wrote:
>> Hi,
>> I'm using unixODBC 2.3.1 to talk to a MySQL database on OS/X 10.7 using the ODBC driver from MySQL.
>> I can connect to the mysql server and issue commands (SHOW DATABASES; USE <database>, …) but based on my configuration I think that a particular database should be USEd when I start up isql. Here's how I'm starting isql:
>> isql myodbc5 jimg
>> And here are my odbc.ini and odbcinst.ini files:
>> odbc.ini:
>> [ODBC Data Sources]
>> data_source_name = myodbc5
>> [myodbc5]
>> Driver          = MyODBC
>> DATABASE        = test
>> SERVER          = localhost
>> UID             = jimg
>> PASSWORD        =
>> # SOCKET          = /tmp/connector-odbc-5.1-64bit/tmp/mysqld.1.sock
>> odbcinst.ini:
>> [ODBC Drivers]
>> MyODBC = Installed
>> # /usr/local/lib/libmyodbc5.so = Installed
>> [MyODBC]
>> Driver = /usr/local/lib/libmyodbc5.so
>> Description = Driver for connecting to MySQL database server
>> Threading = 0
>> Based on this, I think that the database 'test' should be in use once the connection with unixODBC is made. Is that correct? Or is there something I'm missing from this configuration that would enable that behavior?
> I would expect it would, but it depends on a few Driver related things. Does the driver use the Database keyword?, does the driver use unixODBC to read the ini file, if not is it reading the same ini file?
> I can't answer those question, they are driver related so the MySQL folk should be able to give the answer you need.

Thanks for the reply.

I moved over to a linux machine, where the driver was compiled against unixODBC (the OSX driver was built against iODBC). Same problem - although I mis-diagnosed it. The connection is failing. SQLConnect is returning -1. The same arguments passed to isql work (and on Linux the database I expect is the current DB). 

I'll look into writing some code to isolate the problem.

> -- 
> Nick
> _______________________________________________
> unixODBC-support mailing list
> unixODBC-support at mailman.unixodbc.org
> http://mailman.unixodbc.org/mailman/listinfo/unixodbc-support

James Gallagher
jgallagher at opendap.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 203 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <http://mailman.unixodbc.org/pipermail/unixodbc-support/attachments/20120829/0be224e9/attachment.bin>

More information about the unixODBC-support mailing list