Adding data sources for unixODBC/isql on Mac OSX Lion
        Posted  
        
            by 
                NP01
            
        on Server Fault
        
        See other posts from Server Fault
        
            or by NP01
        
        
        
        Published on 2012-06-02T23:51:53Z
        Indexed on 
            2012/06/03
            4:43 UTC
        
        
        Read the original article
        Hit count: 856
        
I have installed unixODBC from source and mysql-odbc connector from .dmg installer on Mac OSX Lion. This was done a while ago, and at that time I successfully installed a data source (let's call it foo). Now I am trying to add another data source (DSN). I've done this through both ODBC Manager and the command-line tool myodbc-installer given with the tar bundle of the mysql-odbc connector from the mysql website. An entry shows up in /Library/ODBC/odbc.ini, which looks like this:
[ODBC Data Sources]
bar = MySQL ODBC 5.1 Driver
[ODBC]
Trace         = 0
TraceAutoStop = 0
TraceFile     = 
TraceLibrary  = 
[myodbc]
Driver = /usr/local/lib/libmyodbc5.so
SERVER = localhost
PORT   = 3306
[bar]
Driver      = /usr/local/lib/libmyodbc5.so
Description = 
DATABASE    = bar
However, isql fails to find it:
anitya:Preferences neil$ isql bar bar bar -v
[IM002][unixODBC][Driver Manager]Data source name not found, and no default driver specified
[ISQL]ERROR: Could not SQLConnect
Weird thing is, the old DSN foo, which is not to be seen in /Library/ODBC/odbc.ini or /etc/odbc.ini, works fine:
anitya:Preferences neil$ isql foo foo foo
+---------------------------------------+
| Connected!                            |
|                                       |
| sql-statement                         |
| help [tablename]                      |
| quit                                  |
|                                       |
+---------------------------------------+
SQL> 
I'm miffed about where the DSN entries need to be entered on OSX Lion to be found by isql. Thanks in advance for your help!
© Server Fault or respective owner