*) Basic concept:
1. Application (Application)
2. ODBC Driver Manager (ODBC Driver manager)
Responsible for managing communication between applications and drivers, including parsing DSNs (data source names, ODBC data source names configured in the Odbc.ini file), loading and unloading drivers, processing ODBC calls, and passing them to drivers.
3. ODBC driver (ODBC Driver)
Implements the functionality provided by the ODBC API, which handles ODBC function calls, submits SQL requests to the specific database server, and returns the results to the application.
4. ODBC Data Source Manager (ODBC Administrator)
Data source information for configuring specific ODBC drivers
5. DSN (Data Source Name)
*) The infrastructure of the application phase
1. Take Mysql-odbc as an example to illustrate an ODBC architecture in the application layer
The following is the Linux version of the Application layer architecture
2. The following is the Windows version of the application-tier architecture
The main difference between the two is that Linux uses Odbc.ini and Odbcinst.ini primarily to manage data sources and drive types, while Windows is stored in the form of a Registry (registry).
*) installed Infrastructure
Linux Edition
Linux version of the driver manager it is not part of the system, users need to compile their own installation UNIXODBC, its data source configuration management needs the user to configure Odbc.ini, Odbcinst.ini.
The Odbcinst.ini configuration is generally as follows:
?
1 2 3 4 |
[mysql] Driver=/usr/local/lib/libmyodbc5.so SETUP=/usr/local/lib/libmyodbc5.so UsageCount=1 |
Windows edition
The driver Manager for Windows comes with the system. The specific driver installer, is composed of two DLLs, one for the specific driver DLL, driver will be loaded by the driver manager, and for the application and backend specific database for data interaction Bridge, and the other is the setup DLL, the main function of this DLL is to configure the data source information .
In MySQL, for example, MYSQL-CONNECTOR/ODBC after installation:
(1). Under the installation path C:\Program files\mysql\connector ODBC 5.3 directory, can find Myodbc5w.dll (driver dll), Myodbc5S.dll (Setup DLL),
(2). At the same time in HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBC. INI directory entry, write the following specific information
The driver key corresponds to the Myodbc5w.dll, and the setup key corresponds to the Myodbc5S.dll absolute path information.
*) Infrastructure for data source configuration
Linux Edition
In MySQL, for example, you need to edit the Odbc.ini file
?
1 2 3 4 5 6 7 8 9 ten page |
[odbc Data Sources] myodbc = MyODBC 2.50 Driver DSN [MYODBC] driver =/usr/local/lib/libmyodbc.so description = MyODBC 2.50 Driver DSN server = localhost port = 3306 user = root password = 123456 database = Test option = 3 socket = |
Windows edition
Enables the ODBC data source Configurator, which reads the data source driver type, and the user can select the System/user/File DSN. After selecting the specific driver and DSN type, the ODBC data source Configuration Manager will load the corresponding setup DLL (dynamic link library) according to the selected ODBC driver, open the specific Graphics configuration window, and when the user visually configures the relevant parameters, the Setup The DLL writes the relevant information to the registry (implementing the CONFIGDSN in the ODBC specification).
The HKEY_CURRENT_USER\SOFTWARE\ODBC\ODBC in the registry. INI, write the following information in the directory entry.
*) Summary
Knowing ODBC's composition/installation/configuration/runtime architecture gives a deeper understanding of ODBC as a whole, understanding how the entire ODBC system works, and provides a theoretical basis for writing an ODBC driver implementation.
*) Reference:
Www.cnblogs.com/linmzh/archive/2012/10/19/2730579.html