ODBC Connector installation & connectivity test for MySQL
Please check your OS version and bit type and download the required ODBC Driver for MySQL from http://dev.mysql.com/downloads/connector/odbc/
[ root @ myhostname : ~ ] cat /etc/redhat-release
Red Hat Enterprise Linux Server release 6.6 (Santiago)
[ root @ myhostname : ~ ]
[ root @ myhostname : ~ ]
[ root @ myhostname : ~ ] cat /proc/cpuinfo | head
processor : 0
vendor_id : GenuineIntel
cpu family : 6
model : 47
model name : Intel(R) Xeon(R) CPU E7- 8870 @ 2.40GHz
stepping : 2
microcode : 55
cpu MHz : 2394.030
cache size : 30720 KB
physical id : 0
[ root @ myhostname : ~ ] ulimit -l
64
[ root @ myhostname : ~ ]
http://dev.mysql.com/downloads/connector/odbc/
[ root @ myhostname : /tmp ] rpm -ivh mysql-connector-odbc-5.3.4-1.el6.x86_64.rpm
- Preparing… ########################################### [100%]
1:mysql-connector-odbc ########################################### [100%]
Success: Usage count is 1
Success: Usage count is 1
[ root @ myhostname : /tmp ]
[ root @ myhostname : /var/lib/mysql ] yum list installed | grep -i mysql
MySQL-client.x86_64 5.6.25-1.el6 @/MySQL-client-5.6.25-1.el6.x86_64
MySQL-server.x86_64 5.6.25-1.el6 @/MySQL-server-5.6.25-1.el6.x86_64
mysql-connector-odbc.x86_64 5.3.4-1.el6 installed
[ root @ myhostname : /var/lib/mysql ]
[ root @ myhostname : /tmp ] rpm -qlp mysql-connector-odbc-5.3.4-1.el6.x86_64.rpm
/usr/bin/myodbc-installer
/usr/lib64/libmyodbc5a.so
/usr/lib64/libmyodbc5w.so
/usr/share/doc/mysql-connector-odbc-5.3.4
/usr/share/doc/mysql-connector-odbc-5.3.4/COPYING
/usr/share/doc/mysql-connector-odbc-5.3.4/ChangeLog
/usr/share/doc/mysql-connector-odbc-5.3.4/INSTALL
/usr/share/doc/mysql-connector-odbc-5.3.4/Licenses_for_Third-Party_Components.txt
/usr/share/doc/mysql-connector-odbc-5.3.4/README
/usr/share/doc/mysql-connector-odbc-5.3.4/README.debug
[ root @ myhostname : /tmp ]
Check the default files are at
[ root @ myhostname : /tmp ] odbcinst -j
unixODBC 2.2.14
- DRIVERS…………: /etc/odbcinst.ini
SYSTEM DATA SOURCES: /etc/odbc.ini
FILE DATA SOURCES..: /etc/ODBCDataSources
USER DATA SOURCES..: /root/.odbc.ini
SQLULEN Size…….: 8
SQLLEN Size……..: 8
SQLSETPOSIROW Size.: 8
[ root @ myhostname : /tmp ]
Configure & install the required config files as below.
[ root @ myhostname : /var/lib/mysql ] cat /etc/odbcinst.ini
[PostgreSQL]
Description = ODBC for PostgreSQL
Driver = /usr/lib/psqlodbc.so
Setup = /usr/lib/libodbcpsqlS.so
Driver64 = /usr/lib64/psqlodbc.so
Setup64 = /usr/lib64/libodbcpsqlS.so
FileUsage = 1
UsageCount = 2
[MySQL]
Description = MySQL driver for Plesk
Driver = /usr/lib64/libmyodbc5.so
Setup =
FileUsage = 1
Driver64 = /usr/lib64/libmyodbc5.so
Setup64 =
UsageCount = 2
[MySQL ODBC 5.3 Unicode Driver]
Driver = /usr/lib64/libmyodbc5w.so
UsageCount = 2
[MySQL ODBC 5.3 ANSI Driver]
Driver = /usr/lib64/libmyodbc5a.so
UsageCount = 2
[ root @ myhostname : /var/lib/mysql ]
[ root @ myhostname : /var/lib/mysql ] cat /etc/odbc.ini
[mysqldsn]
Driver = /usr/lib64/libmyodbc5w.so
SERVER = localhost
PORT = 3306
DATABASE = test
OPTION = 3
USER =
PASSWORD =
[ root @ myhostname : /var/lib/mysql ]
[ root @ myhostname : /var/lib/mysql ] odbcinst -i -s -l -f /etc/odbc.ini
[ root @ myhostname : /var/lib/mysql ]
[ root @ myhostname : /var/lib/mysql ] odbcinst -s –q /// To check whether DSN installed properly/not
[mysqldsn]
[ root @ myhostname : /var/lib/mysql ]
[ root @ myhostname : /var/lib/mysql ] odbcinst -i -d -f /etc/odbcinst.ini
odbcinst: Driver installed. Usage count increased to 2.
Target directory is /etc
odbcinst: Driver installed. Usage count increased to 2.
Target directory is /etc
odbcinst: Driver installed. Usage count increased to 2.
Target directory is /etc
odbcinst: Driver installed. Usage count increased to 2.
Target directory is /etc
[ root @ myhostname : /var/lib/mysql ]
Create below soft links if you install it from /tmp
[ root @ myhostname : /var/lib/mysql ] ln -s /var/lib/mysql/mysql.sock /tmp/mysql.sock
[ root @ myhostname : /var/lib/mysql ] ln -s /usr/lib64/libmyodbc5w.so /usr/lib64/libmyodbc5.so
Test the connectivity as below.
[ root @ myhostname : /var/lib/mysql ]
[ root @ myhostname : /var/lib/mysql ] isql -v mysqldsn
+—————————————+
| Connected! |
| |
| sql-statement |
| help [tablename] |
| quit |
| |
+—————————————+
SQL> show databases;
+—————————————————————–+
| Database |
+—————————————————————–+
| information_schema |
| mysql |
| performance_schema |
| test |
+—————————————————————–+
SQLRowCount returns 4
4 rows fetched