Odbc configuration for Mysql in Linux (modify blog posts on the Internet)

Source: Internet
Author: User
Tags driver manager

Odbc configuration for Mysql in Linux (modify blog posts on the Internet)-lin maozhi-blog Garden

Odbc configuration for Mysql in Linux (modify the web blog)

InInstallBefore configuration, you need to know about the architecture of MyODBC. The architecture of MyODBC is built on five components, as shown in:

 

 

Driver Manager:

 

ResponsibleManagementCommunication between applications and drivers. The main functions include: Resolve DSN (Data Source Name, ODBC Data Source Name in ODBC. INI file configuration), load and uninstall the driver, process ODBC calls, and pass them to the driver.

 

Connector/ODBC (MyODBCDriver ):

 

Implements the functions provided by the odbc api. It is responsible for processing ODBC function calls andSQLRequest SubmittedMySQLServerAnd return the result to the application.

 

ODBC. INI

ODBC. INI is an ODBC configuration file that records the driver information andDatabaseInformation. Driver Manager will use it to determine which Driver to load (using the data source name DSN ). The driver reads the connection Parameters Based on the specified DSN.

 

To configure mysql ODBC in Linux, follow these steps:

1. install Driver Manager. In this case, unixODBC is used as Driver Manager.

2.Install the MySQL driver. In this case, ctor/ODBC is used.

3.Configure ODBC. INI

 

 

Step 1:Download the installation package.

 

You need to download two installation packages unixODBC 2.3.0 and mysql Connector/ODBC 3.51.

UnixODBC source package: ftp://ftp.unixodbc.org/pub/unixODBC/unixODBC-2.3.0.tar.gz

 

Step 2

Http://dev.mysql.com/downloads/connector/odbc/3.51.html%23downloads

Select

Version: 5.1.11

Platform: Oracle & Red Hat Linux6

Download: mysql-connector-odbc-5.1.11-linux-el6-x86-64bit.tar.gz

 

 

Step 2:InstallUnixODBC

 

Tar zxvf unixODBC-2.3.0.tar.gz

Cd unixODBC-2.3.0

. /Configure -- prefix =/usr/local/unixODBC-2.3.0 -- export dedir =/usr/include -- libdir =/usr/local/lib-bindir =/usr/bin -- sysconfdir =/usr/ local/etc

Make

Make install

 

After the installation is complete, you can have the following files in the/usr/bin directory.

-Rwxr-xr-x 1 root 75312 Nov 1 odbcinst

-Rwxr-xr-x 1 root 10922 Nov 1 16:22 odbc_config

-Rwxr-xr-x 1 root 37650 Nov 1 iusql

-Rwxr-xr-x 1 root 44400 Nov 1 isql

-Rwxr-xr-x 1 root 95903 Nov 1 dltest

 

These files are stored in the/usr/local/lib directory.

 

-Rwxr-xr-x 1 root 422955 Nov 1 libodbcinst. so.1.0.0

Lrwxrwxrwx 1 root 20 Nov 1 16:22 libodbcinst. so.1-> libodbcinst. so.1.0.0

Lrwxrwxrwx 1 root 20 Nov 1 16:22 libodbcinst. so-> libodbcinst. so.1.0.0

-Rwxr-xr-x 1 root 981 Nov 1 libodbcinst. la

-Rwxr-xr-x 1 root 1691572 Nov 1 libodbc. so.1.0.0

Lrwxrwxrwx 1 root 16 Nov 1 libodbc. so.1-> libodbc. so.1.0.0

Lrwxrwxrwx 1 root 16 Nov 1 libodbc. so-> libodbc. so.1.0.0

-Rwxr-xr-x 1 root 957 Nov 1 libodbc. la

-Rwxr-xr-x 1 root 489405 Nov 1 libodbcr. so.1.0.0

Lrwxrwxrwx 1 root 18 Nov 1 16:22 libodbcr. so.1-> libodbcr. so.1.0.0

Lrwxrwxrwx 1 root 18 Nov 1 16:22 libodbcr. so-> libodbcr. so.1.0.0

-Rwxr-xr-x 1 root 969 Nov 1 libodbcr. la

 

 

Step 3:InstallMysql Connector/ODBC

 

Tar zxvf mysql-connector-odbc-5.1.11-linux-el6-x86-64bit.tar.gz

Cd mysql-connector-odbc-5.1.11-linux-el6-x86-64bit \ lib

Cp libmydbc5.so/usr/local/lib

Cd ../

Cd bin

1. Registration driver

./Myodbc-installer-d-a-n "MySQL ODBC 5.1 Driver "\

-T "DRIVER =/usr/lib/libmydbc5.so; SETUP =/usr/lib/libmydbc5.so"

 

 

Step 4:ConfigurationODBC. INI:

 

Edit the file/usr/local/etc/odbc. ini, add the following content. note that there are minor differences in the configuration methods of mysql drivers of different versions. in this case, mysql Connector 3.51 is used.

 

[MysqlDSN]

Driver =/usr/local/lib/libmydbc5.so

Description = MyODBC 5 Driver DSN

SERVER = 172.31.108.20.

PORT = 3306

USER = root

Password = 123456

Database = PM

OPTION = 3

SOCKET =

 

 

 

Step 5:Set Environment Variables

 

Export DBCINI =/usr/local/etc/odbc. ini

Export DBCSYSINI =/usr/local/etc

Step 6: restart your computer

Reboot

Step 7:TestODBCConfiguration successful

 

Isql is an ODBC client access tool in unixODBC. It uses isql + data source name to access the target database.

If ODBC is correctly configured, the following interface is displayed. Enter an SQL statement at the SQL> prompt to query the database.

 

# Isql mysqlDSN

+ --------------------------------------- +

| Connected! |

|

| SQL-statement |

| Help [tablename] |

| Quit |

|

+ --------------------------------------- +

 

 

Reference Source Text http://space.itpub.net/81/viewspace-710064

Discovered during implementationThe versions of mysql Connector/ODBC are inconsistent.

InInstallBefore configuration, you need to know about the architecture of MyODBC. The architecture of MyODBC is built on five components, as shown in:

 

 

Driver Manager:

 

ResponsibleManagementCommunication between applications and drivers. The main functions include: Resolve DSN (Data Source Name, ODBC Data Source Name in ODBC. INI file configuration), load and uninstall the driver, process ODBC calls, and pass them to the driver.

 

Connector/ODBC (MyODBCDriver ):

 

Implements the functions provided by the odbc api. It is responsible for processing ODBC function calls andSQLRequest SubmittedMySQLServerAnd return the result to the application.

 

ODBC. INI

ODBC. INI is an ODBC configuration file that records the driver information andDatabaseInformation. Driver Manager will use it to determine which Driver to load (using the data source name DSN ). The driver reads the connection Parameters Based on the specified DSN.

 

To configure mysql ODBC in Linux, follow these steps:

1. install Driver Manager. In this case, unixODBC is used as Driver Manager.

2.Install the MySQL driver. In this case, ctor/ODBC is used.

3.Configure ODBC. INI

 

 

Step 1:Download the installation package.

 

You need to download two installation packages unixODBC 2.3.0 and mysql Connector/ODBC 3.51.

UnixODBC source package: ftp://ftp.unixodbc.org/pub/unixODBC/unixODBC-2.3.0.tar.gz

 

Step 2

Http://dev.mysql.com/downloads/connector/odbc/3.51.html%23downloads

Select

Version: 5.1.11

Platform: Oracle & Red Hat Linux6

Download: mysql-connector-odbc-5.1.11-linux-el6-x86-64bit.tar.gz

 

 

Step 2:InstallUnixODBC

 

Tar zxvf unixODBC-2.3.0.tar.gz

Cd unixODBC-2.3.0

. /Configure -- prefix =/usr/local/unixODBC-2.3.0 -- export dedir =/usr/include -- libdir =/usr/local/lib-bindir =/usr/bin -- sysconfdir =/usr/ local/etc

Make

Make install

 

After the installation is complete, you can have the following files in the/usr/bin directory.

-Rwxr-xr-x 1 root 75312 Nov 1 odbcinst

-Rwxr-xr-x 1 root 10922 Nov 1 16:22 odbc_config

-Rwxr-xr-x 1 root 37650 Nov 1 iusql

-Rwxr-xr-x 1 root 44400 Nov 1 isql

-Rwxr-xr-x 1 root 95903 Nov 1 dltest

 

These files are stored in the/usr/local/lib directory.

 

-Rwxr-xr-x 1 root 422955 Nov 1 libodbcinst. so.1.0.0

Lrwxrwxrwx 1 root 20 Nov 1 16:22 libodbcinst. so.1-> libodbcinst. so.1.0.0

Lrwxrwxrwx 1 root 20 Nov 1 16:22 libodbcinst. so-> libodbcinst. so.1.0.0

-Rwxr-xr-x 1 root 981 Nov 1 libodbcinst. la

-Rwxr-xr-x 1 root 1691572 Nov 1 libodbc. so.1.0.0

Lrwxrwxrwx 1 root 16 Nov 1 libodbc. so.1-> libodbc. so.1.0.0

Lrwxrwxrwx 1 root 16 Nov 1 libodbc. so-> libodbc. so.1.0.0

-Rwxr-xr-x 1 root 957 Nov 1 libodbc. la

-Rwxr-xr-x 1 root 489405 Nov 1 libodbcr. so.1.0.0

Lrwxrwxrwx 1 root 18 Nov 1 16:22 libodbcr. so.1-> libodbcr. so.1.0.0

Lrwxrwxrwx 1 root 18 Nov 1 16:22 libodbcr. so-> libodbcr. so.1.0.0

-Rwxr-xr-x 1 root 969 Nov 1 libodbcr. la

 

 

Step 3:InstallMysql Connector/ODBC

 

Tar zxvf mysql-connector-odbc-5.1.11-linux-el6-x86-64bit.tar.gz

Cd mysql-connector-odbc-5.1.11-linux-el6-x86-64bit \ lib

Cp libmydbc5.so/usr/local/lib

Cd ../

Cd bin

1. Registration driver

./Myodbc-installer-d-a-n "MySQL ODBC 5.1 Driver "\

-T "DRIVER =/usr/lib/libmydbc5.so; SETUP =/usr/lib/libmydbc5.so"

 

 

Step 4:ConfigurationODBC. INI:

 

Edit the file/usr/local/etc/odbc. ini, add the following content. note that there are minor differences in the configuration methods of mysql drivers of different versions. in this case, mysql Connector 3.51 is used.

 

[MysqlDSN]

Driver =/usr/local/lib/libmydbc5.so

Description = MyODBC 5 Driver DSN

SERVER = 172.31.108.20.

PORT = 3306

USER = root

Password = 123456

Database = PM

OPTION = 3

SOCKET =

 

 

 

Step 5:Set Environment Variables

 

Export DBCINI =/usr/local/etc/odbc. ini

Export DBCSYSINI =/usr/local/etc

Step 6: restart your computer

Reboot

Step 7:TestODBCConfiguration successful

 

Isql is an ODBC client access tool in unixODBC. It uses isql + data source name to access the target database.

If ODBC is correctly configured, the following interface is displayed. Enter an SQL statement at the SQL> prompt to query the database.

 

# Isql mysqlDSN

+ --------------------------------------- +

| Connected! |

|

| SQL-statement |

| Help [tablename] |

| Quit |

|

+ --------------------------------------- +

 

 

Reference Source Text http://space.itpub.net/81/viewspace-710064

Discovered during implementationThe versions of mysql Connector/ODBC are inconsistent.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.