1
votes

I am trying to connect Rattle to MySQL database. Both Rattle and MySQL are on my laptop (ubuntu 14.04). Since Rattle connects to MySQL only by ODBC I followed the post here to install ODBC. I did the following

  1. Installed the ODBC drivers using the following command

    apt-get install libmyodbc unixodbc-bin

  2. My ODBC Driver location is as follows

    root@sridhar-Aspire-5745:/home/sridhar# find / -name 'libodbc.so' /usr/lib/i386-linux-gnu/odbc/liboplodbcS.so /usr/lib/i386-linux-gnu/odbc/libodbcdrvcfg2S.so /usr/lib/i386-linux-gnu/odbc/libodbctxtS.so /usr/lib/i386-linux-gnu/odbc/libodbcdrvcfg1S.so /usr/lib/i386-linux-gnu/odbc/libodbcpsqlS.so /usr/lib/i386-linux-gnu/odbc/libodbcmyS.so /usr/lib/i386-linux-gnu/odbc/libodbcminiS.so /usr/lib/i386-linux-gnu/odbc/libodbcnnS.so /usr/lib/i386-linux-gnu/odbc/libmyodbc.so /usr/lib/i386-linux-gnu/odbc/liboraodbcS.so

  3. Created the ODBC installation file (/etc/odbcinst.ini) with the following contents

    [myodbc_mysql]
    Description = ODBC for MySQL
    Driver = /usr/lib/i386-linux-gnu/odbc/libmyodbc.so
    Setup = /usr/lib/i386-linux-gnu/odbc/libodbcmyS.so
    UsageCount = 6

  4. Determined the MySQL Socket path

    root@sridhar-Aspire-5745:/home/sridhar# mysqladmin -u root -p version
    Enter password:
    mysqladmin Ver 8.42 Distrib 5.5.46, for debian-linux-gnu on i686
    Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.

    Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners.

    Server version 5.5.46-0ubuntu0.14.04.2
    Protocol version 10
    Connection Localhost via UNIX socket
    UNIX socket /var/run/mysqld/mysqld.sock
    Uptime: 4 hours 41 min 49 sec

    Threads: 1 Questions: 229 Slow queries: 1 Opens: 1156 Flush tables: 1 Open tables: 400 Queries per second avg: 0.013

  5. Created /etc/odbc.ini with the following contents

    [myodbc_mysql_rattle]
    Description = rattle
    Driver = myodbc_mysql # custom driver name
    Server = localhost # or external IP if needed
    Port = 3306 # or custom port if needed
    Socket = /var/run/mysqld/mysqld.sock # socket, see above
    Database = # MySQL DB name or empty
    Option = 3
    ReadOnly = No

  6. Installed the ODBC driver

    root@sridhar-Aspire-5745:/home/sridhar# odbcinst -i -d -f /etc/odbcinst.ini
    odbcinst: Driver installed. Usage count increased to 7.
    Target directory is /etc

  7. Installed the system DSN

    root@sridhar-Aspire-5745:/home/sridhar# odbcinst -i -s -l -f /etc/odbc.ini

  8. checked if the system DSN was installed successfully

    root@sridhar-Aspire-5745:/home/sridhar# odbcinst -s -q [myodbc_mysql_rattle]

  9. Tested if I can connect to the MySQL DB (the **** indicates the password!)

    isql -v myodbc_mysql_rattle root ****

only to get

[IM002][unixODBC][Driver Manager]Data source name not found, and no default driver specified <br>
[ISQL]ERROR: Could not SQLConnect

I have repeated this 7 times! I am still unable to understand why the DSN cannot be found by isql.

1

1 Answers

2
votes

Assuming system files default location for unixODBC was not /etc. You might want to define & export ODBCINI=/etc/odbc.ini and ODBCSYSINI=/etc