A summary of the problem of database connection

Source: Internet
Author: User
Tags dsn connect odbc ole
The relationship of 1.odbc,oledb,ado,adox:
ODBC: Used database communication standards
OLE DB: In all the object-oriented trends, MS intends to use it instead of ODBC.
OLE DB is divided into two types: direct OLE DB and ODBC-oriented OLE DB, the latter architecture on ODBC, which
Databases that do not have their own OLE DB providers can also use the features of OLE DB.
ADO: is actually just an application-level interface that uses OLE DB to communicate with the database.
ADOX: The security of ADO, maintenance (such as: Create a database) has been extended.

2. Connect to the database with ODBC:
There are three types of DSNs available in ODBC, and the difference is simple: a user DSN can only be used for this user. The difference between a System DSN and a file DSN is only that the connection information is stored in a different location: The System DSN is stored in an ODBC storage area, and the file DSN is placed in a text file.
The way they are created is not said.
When using them in ASP, the following are written:
A.sql Server:
Using the system dsn:connstr= "DSN=DSNNAME;" Uid=xx; Pwd=xxx;database=dbname "
Use the document Dsn:connstr= "FILEDSN=XX; Uid=xx; Pwd=xxx;database=dbname "
You can also use a connection string (thereby eliminating the need to create a DSN):
Connstr= "Driver={sql SERVER}; Server=servername; Uid=xx; Pwd=xxx "
B.access:
Using the system dsn:connstr= "Dsn=dsnname"
(or for: connstr= "dsn=dsnname; Uid=xx; Pwd=xxx ")
Dsn:connstr= "Filedsn=xx" with file
You can also use a connection string (thereby eliminating the need to create a DSN):
Connstr= "Driver={microsoft Access DRIVER};D Bq=d:\abc\abc.mdb"

3. Connect the database with OLE DB:
A.sql Server:
Connstr= "PROVIDER=SQLOLEDB;
DATA Source=servername; Uid=xx; Pwd=xxx;database=dbname "
B.access:
Connstr= "Provicer=microsoft. JET. oledb.4.0;
DATA Source=c:\abc\abc.mdb "

4. Use UDL file:
A UDL file is a text file that holds database connection information, somewhat like a file DSN, but the UDL is for OLE DB (direct and ODBC-oriented).
How to create a UDL:
Right-click the desktop or Resource Manager-new-"Microsoft Data Connection"
The setup work should be more clear.
Use of UDL:
connstr= "File Name=e:\abc\abc.udl"


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.