ODBC (OpenDatabaseConnectivity, Open Database interconnection) is an integral part of the database in Microsoft's WOSA (WindowsOpenServicesArchitecture). It establishes a set of specifications, it also provides a set of standard APIs for database access (application programming interfaces ). These APIs use SQL to complete most of their tasks
ODBC (Open Database Connectivity) is an integral part of the Database in Microsoft's WOSA (Windows Open Services Architecture). It establishes a set of specifications, it also provides a set of standard APIs for database access (application programming interfaces ). These APIs use SQL to complete most of their tasks
ODBC (Open Database Connectivity) is an integral part of Microsoft's WOSA (Windows Open Services Architecture). It establishes a set of specifications, it also provides a set of standard APIs for database access (application programming interfaces ). These APIs use SQL to complete most of their tasks. ODBC also provides support for the SQL language. You can directly send SQL statements to ODBC.
An ODBC-based application does not rely on any DBMS for database operations and does not directly deal with DBMS. All database operations are completed by the corresponding dbms odbc driver. That is to say, both FoxPro, Access, MYSQL, and Oracle databases can be accessed using ODBC APIs. It can be seen that the biggest advantage of ODBC is that it can process all databases in a unified manner.
1. Use Microsoft ole db Provider For ODBC to link MySQL
Install MySQL ODBC driver MyODBC
1. Create an ODBC data source for MySQL. For example, set database to test and data source name
String 6
MyDSN
String 8
2. Create a linked Database
EXEC sp_addmediaserver @ server = 'mysqltest', @ srvproduct = 'mysqltest', string 8
@ Provider = 'msdasql ', @ datasrc = 'mydsn'
GO
EXEC sp_add1_srvlogin string 8
@ Rmtsrvname = 'mysqltest', @ useself = 'false', @ locallogin = 'sa ', @ rmtuser = 'mys string 7
Ql Username ', @ rmtpassword = 'mysql password'
String 8
3. query data
String 1
SELECT * from openquery (MySQLTest, 'select * from table ')
String 4
This is not acceptable below:
SELECT * from openquery (MySQLTest, 'table') string 1
Note: you cannot directly use the select * from Link name. Database Name. User Name. Table (or view)
String 2
The four-part name query data may be a Bug. String 4
2. Use Microsoft ole db Provider For ORACLE to connect to ORACLE
String 5
1. Create a linked Database
Sp_addmediaserver 'Alias ', 'oracle', 'msdaora ', 'service name'
GO
EXEC sp_add1_srvlogin @ rmtsrvname = 'Alias string 4
', @ Useself = 'false', @ locallogin = 'sa', @ rmtuser = 'oracle User Name
String 5
', @ Rmtpassword = 'Password' string 3
2. query data string 1
SELECT * FROM alias... username. Table (view)
String 6
Note: All the four parts are in uppercase.
String 8
3. Execute the Stored Procedure string 5
Use OPENQUERY:
SELECT *
From openquery (alias, 'exec user name. Stored Procedure name ')
String 6