About data source connection providers and data source connections

Source: Internet
Author: User
Tags dsn odbc ole access database microsoft access database
I am a beginner of ASP, after a little bit, let me puzzle is the connection of the database, I often see for the same Microsoft Access database in two ways, or three, or even four ways of connection, the most I do not understand these two kinds:
<%
Set conn=server.createobject ("ADODB. Connection ")
Conn. Open "Provider=Microsoft.Jet.OLEDB.4.0; Data source=databasename; "
%>
<%
Set conn=server.createobject ("ADODB. Connection ")
Conn. Open "Dbq=databasename; Driver=microsoft Access Driver (*. MDB); "
%>
Why is that so? With such a problem, I began to systematically look at the problem of data source connectivity. What made me realize was that Xmxoxo had given us an ADO structure diagram and that I used the OLE DB data Connection file (. udl) file to create a data source connection.
Structure diagram of ADO:
Now I'll talk about my general view of the data source connection.
The first thing to be sure of is this ADO diagram, the pattern of ADO is that all data sources must be accessed through OLE DB interfaces, that is, ADO expects all data sources to provide drivers for OLE DB interfaces.
As we all know, all of the database management systems we use today--dbms can actually exchange visits through ODBC, because ODBC provides a variety of data sources to drive.
However, the unified interface of ADO accessing the data source is an OLE DB interface, so that although more and more database vendors are beginning to provide OLE DB interfaces, such as SQL Server, Oracle, and Microsoft Access (Microsoft Jet Database engine), and so on, but there are still some data sources that are not available in this way and still need to be provided to OLE DB with the help of ODBC drivers. In this way, OLE DB defines an interface that is embedded with ODBC-driven, like an ODBC driver plugged into an OLE DB model socket like other database-driven providers. The name of the ODBC interface (OLE DB provider) is the Microsoft OLE DB Provider for ODBC drivers, which is the default provider for ADO. Keyword provider value is MSDASQL, can omit not write, so we in the establishment of data source connection, did not see provider words, that means, is certainly ODBC provided driver.
What do you think? Two nouns that have puzzled me for a long time OLE DB and ODBC I finally saw it clearly.
In fact, simply put, these two things cannot be equated because they are not a category. ODBC is a benevolent lord, a provider of drivers for a variety of data sources, and OLE DB is a dictator, and it wants all data sources to yield to it, providing a driver that conforms to its standards.
Next we use practice to prove that our ODBC is really controlled by OLE DB.
It's usually written in a book. A database usually has a "DSN method and a non-DSN method", which is only for ODBC drivers. Only "UDL" and "non-UDL" methods are available for OLE DB, as we can see "DSN method and Non-DSN method" only in the case of "non-UDL mode" under OLE DB.

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.