[unixODBC-support] What is the Nature of Data Source Names under unixODBC?

Ken Resander kresander at yahoo.com
Fri May 8 19:07:48 BST 2009


About 4-5  years ago I worked on an Intelli-sense type interactive input system
for databases DB2, Mimer, MySQL and SQL Server that ran on Windows. I am now porting this, all other Windows projects and myself to Ubuntu.

Started porting the DB stuff about two weeks ago. Here are the connect calls on Windows, which I assumed would work Ubuntu under unixODBC. Only one did.

//            first three parameters: dsn       userid  password
connectSrv ( "MySQL_1" , "root" , "" , &sh )
connectSrv ( "DB2_1" , "db2admin" , "abcd" , &sh )
connectSrv ( "kenmimer" , "mimer_store" , "abcd" , &sh )
connectSrv ( "ASA 9.0 Sample" , "" , "" , &sh )



I could connect to MySQL more or less right away, but spent about a week on DB2 and Mimer SQL. They both came up with SQLConnect error messages 'DB2_1 not a valid database alias name' and 'kenmimer is not a valid database name'. On Windows I had been conditioned to think that a DSN is just an arbitrary shorthand notation for connection attributes passed from the application to the ODBC system via the SQLConnect, so I just could not understand why it did not work. As a last resort, I changed the DB2_1 dsn to SAMPLE, which is the name of the DB2 sample database. It worked. Mimer SQL worked too when I changed the kenmimer dsn to the name of Mimer's sample database.

MySQL_1 is not a name of one of MySQL's sample databases, but it worked. 


I have just managed to get SQL Anywhere to connect to its demo database using the following /etc/odbc.ini:

[SQL Anywhere 11 Demo]
UserID=DBA
Password=sql
DatabaseFile=/home/ken/sa11_samples/sqlanywhere/demo.db
ServerName=demo_ken
StartLine=/opt/sqlanywhere11/bin32/dbeng11
Description=SQL Anywhere 11 Sample Database
Driver=/opt/sqlanywhere11/lib32/libdbodbc11.so

It did not work when I put [sqlanywheredsn] into /etc/odbc.ini and into my SQLConnect call. Received message 'sqlanywhere not a dsn', so again, it seems the dsn has to be a database name.

What are the rules? The DSN can be an arbitrary string in MySQL, but has to be a databasename for the other databases. Is the decision made by unixODBC, the driver or both?

I really itching to understand this.





      New Email addresses available on Yahoo!
Get the Email name you've always wanted on the new @ymail and @rocketmail. 
Hurry before someone else does!
http://mail.promotions.yahoo.com/newdomains/aa/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.unixodbc.org/pipermail/unixodbc-support/attachments/20090508/4fbbc3ab/attachment.html>


More information about the unixODBC-support mailing list