Pocket database connection query manual _ MySQL

Source: Internet
Author: User
The following information may not be complete, but it can be used for normal data query. I hope it will help you. The following describes several ADO Connection methods: ODBCDSN, ODBCDSN-Less, OLEDBProvider, and MSRemoteProvider.1. ODBCDSN connection I. DSNoConn. OpenDSNAdvWorks; _ UIDAdmin; _ PWD manual

The following information may not be complete, but it can be used for normal data query. I hope it will help you.

The following describes several ADO Connection methods: odbc dsn, odbc dsn-Less,
Ole db Provider, and "MS Remote" Provider.
1. Odbc dsn connection
I. DSN
OConn. Open "DSN = AdvWorks ;"&_
"UID = Admin ;"&_
"PWD = ;"
Note: this method cannot be used since MDAC2.1, that is, only the DSN file name is placed in ConnectString.
You must also use the DSN, UID, PWD flag. For example, the following method will cause an error in MDAC 2.1:
OConn. Open "AdvWorks"

II. File DSN
OConn. Open "FILEDSN = \ somepath \ mydb. dsn ;"&_
"UID = Admin ;"&_
"PWD = ;"
III. odbc dsn-Less Connections
A) ODBC Text Driver
OConn. Open _
"Driver = {Microsoft Text Driver (*. txt; *. csv )};"&_
"Dbq = \ somepath \;"&_
"Extensions = asc, csv, tab, txt ;"&_
"Persist Security Info = False"
Note: You must specify the file name used in the SQL statement. For example:
ORs. Open "Select * From mermer.csv ",_
OConn, adOpenStatic, adLockReadOnly, ad1_text
B) ODBC Driver for Access
I) general security mode:
OConn. Open _
"Driver = {Microsoft Access Driver (*. mdb )};"&_
"Dbq = \ somepath \ mydb. mdb ;"&_
"Uid = Admin ;"&_
"Pwd = ;"
Ii) if System database is used:
OConn. Open _
"Driver = {Microsoft Access Driver (*. mdb )};"&_
"Dbq = \ somepath \ mydb. mdb ;"&_
"SystemDB = \ somepath \ mydb. mdw ;",_
"Admin ",""
C) ODBC Driver for SQL Server
I) general security mode
OConn. Open "Driver = {SQL Server };"&_
"Server = carl2 ;"&_
"Database = pubs ;"&_
"Uid = sa ;"&_
"Pwd = ;"
Ii) use the trusted security mode:
OConn. Open "Driver = {SQL Server };"&_
"Server = carl2 ;"&_
"Database = pubs ;"&_
"Uid = ;"&_
"Pwd = ;"
Note: Use the empty Uid and Pwd.
D) ODBC Driver for Oracle
I) use the existing Oracle ODBC Driver from Microsoft:
OConn. Open _
"Driver = {Microsoft ODBC for Oracle };"&_
"Server = OracleServer. world ;"&_
"Uid = demo ;"&_
"Pwd = demo ;"
Ii) use the old version of Oracle ODBC Driver from Microsoft:
OConn. Open _
"Driver = {Microsoft ODBC Driver for Oracle };"&_
"ConnectString = OracleServer. world ;"&_
"Uid = demo ;"&_
"Pwd = demo ;"
IIII) use Microsoft's ole db Data Link Connections method Data Link File (UDL)
A) use absolute path
OConn. Open "File Name = \ somepath \ pubs. udl ;"
B) use relative paths
OConn. Open "File Name = pubs. udl ;"
V) ole db Provider Connections mode
A) ole db Provider for ODBC Databases
I) Access (Jet ):
OConn. Open _
"Provider = MSDASQL ;"&_
"Driver = {Microsoft Access Driver (*. mdb )};"&_
"Dbq = \ somepath \ mydb. mdb ;"&_
"Uid = Admin ;"&_
"Pwd = ;"
Ii) SQL Server:
OConn. Open _
"Provider = MSDASQL ;"&_
"Driver = {SQL Server };"&_
"Server = carl2 ;"&_
"Database = pubs ;"&_
"Uid = sa ;"&_
"Pwd = ;"
B) OLE DB Provider for Microsoft Jet (Access)
I) general security mode:
OConn. Open _
"Provider = Microsoft. Jet. OLEDB.4.0 ;"&_
"Data Source = \ somepath \ mydb. mdb ;"&_
"User Id = admin ;"&_
"Password = ;"
Ii) if System database is used:
OConn. Open _
"Provider = Microsoft. Jet. OLEDB.4.0 ;"&_
"Data Source = \ somepath \ mydb. mdb ;"&_
"Jet OLEDB: System Database = system. mdw ;",_
"Admin ",""
Note: When ole db Provider4.0 is used, you need to convert the MDB and MDW files to the 4.0 database format.
Iii) If MDB requires a database password:
OConn. Open _
"Provider = Microsoft. Jet. OLEDB.4.0 ;"&_
"Data Source = \ somepath \ mydb. mdb ;"&_
"Jet OLEDB: Database Password = MyDbPassword ;",_
"Admin ",""
C) ole db Provider for Excel Spreadsheet:
OConn. Open _
"Provider = Microsoft. Jet. OLEDB.4.0 ;"&_
"Data Source = \ somepath \ expenses.xls ;"&_
"Extended Properties =" "Excel 8.0; HDR = Yes ;"";"
Note: "HDR = Yes" indicates the row title in the first line. in the provider, the first line is not included in the recordset.
D) ole db Provider for SQL Server
I) general security mode:
OConn. Open "Provider = sqloledb ;"&_
"Network Library = DBMSSOCN ;"&_
"Data Source = carl2 ;"&_
"Initial Catalog = pubs ;"&_
"User Id = sa ;"&_
"Password = ;"
Ii) use the trusted security mode:
OConn. Open "Provider = sqloledb ;"&_
Network Library = DBMSSOCN ;"&_
"Data Source = carl2 ;"&_
"Initial Catalog = pubs ;"&_
"Trusted_Connection = yes ;"
Note: "Network Library = DBMSSOCN" declares that ole db uses TCP/IP to replace Named Pipes.
E) ole db Provider for Oracle
OConn. Open "Provider = msdaora ;"&_
"Data Source = OracleServer. world ;"&_
"User Id = sa ;"&_
"Password = ;"
(VI) Remote ole db Provider Connections method (that is, the RDS method I have been studying, huh, huh .) :
A) the MS Remote-Access (Jet)
I) ODBC DSN:
OConn. Open "Remote Server = http: // carl2 ;"&_
"Remote Provider = MSDASQL ;"&_
"DSN = AdvWorks ;"&_
"Uid = admin "&_
"Pwd = ;"
Ii) ole db Provider:
OConn. Open "Provider = MS Remote ;"&_
"Remote Server = http: // carl2 ;"&_
"Remote Provider = Microsoft. Jet. OLEDB.4.0 ;"&_
"Data Source = \ somepath \ mydb. mdb ;",_
"Admin ",""
Iii) ole db Provider custom transaction object
OConn. Open "Provider = MS Remote ;"&_
"Remote Server = http: // carl2 ;"&_
"Handler = MSDFMAP. Handler ;"&_
"Data Source = MyAdvworksOLEDBConnectTag ;"
B) MS Remote-SQL Server
I) ODBC DSN:
OConn. Open "Remote Server = http: // carl2 ;"&_
"Remote Provider = MSDASQL ;"&_
"Network Library = DBMSSOCN ;"&_
"DSN = Pubs ;"&_
"Uid = sa "&_
"Pwd = ;"
Ii) ole db Provider
OConn. Open "Provider = MS Remote ;"&_
"Remote Server = http: // carl2 ;"&_
"Remote Provider = SQLOLEDB ;"&_
"Network Library = DBMSSOCN ;"&_
"Data Source = carl2 ;"&_
"Initial Catalog = pubs ;"&_
"User ID = sa ;"&_
"Password = ;"

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.