OLEDB connection profile

zhaozj2021-02-16  95

There are many ways to connect to a database. You can use the System DSN, DSN-LESS to connect or local OLEDB Provider. OLEDB? What kind of play? Maybe many people in you have never heard of it before. Answer this question, let's review the history of the database connection. Early database connections are very difficult. Each database is different, developers have a deep understanding of the underlying API of each database they develop. Therefore, the general API that can deal with a variety of databases will be born. That is, the current ODBC (Open Database Connectivity), ODBC is the early product of people in creating a general API. There are many databases compliance with this Standard, known as ODBC compatible databases. ODBC compatible databases include Access, MS-SQL Server, Oracle, Informix, etc. However, ODBC is not perfect, it still contains a lot of low-level calls, develop ODBC applications still Difficult. Developers have to spend a lot of effort in the underlying database communication without focusing on the data they want. Later, Microsoft puts forward a solution: DAO (Data Access Objects). Dao code looks like this : Objitem.addnew objitem.name = "chair" objitem.price = 10 Objitem.Update You may have seen Dao code. Later, DAO evolved into RDO (Remote Data Objects, designed for distributed database system), then ADO. Although they have their own shortcomings. According to Microsoft, "ODBC provides access to local SQL data, DAO provides advanced data objects." DAO and RDO require data to be formatted by SQL (Structure Query Language) Storage. For these defects, Microsoft proposes OLEDB, a COM-based data storage object, can provide operations for all types of data, even access data in the case of offline (more, you are using your portable Machine, you can see the data image when the last data is synchronized. OLEDB is located between the ODBC layer and the application. In your ASP page, ADO is "app" on OLEDB. You The ADO call first is sent to OLEDB, then hand it over to ODBC. You can connect directly to the OLEDB layer, if you do this, you will see the server-side game (the default cursor of Recordset, the most commonly used cursor Performance improvement So how do we connect directly to OLEDB? To connect directly to the OLEDB layer, you must change your Connection object connection string. First create a ConnectionG object with the old way: Dim objconn set objconn = Server.createObject ("AdoDB .Connection ") Next, we don't need a regular similar DSN = Pubs or Driver = {MS SQL-Server}; UID = SA; PWD =; Database = PUBS; Server = MyMachine connection string, using the following connection characters string: objConn.ConnectionString = "Provider = ProviderName; Data Source = DatabaseSource; Initial Catalog = DatabaseName; User ID = UserID; Password = Password" to SQL: ProviderName = SQLOLEDB Data Source = Server Name Initial Catalog = Database Name for Access: ProviderName = Microsoft.jet.Oledb.3.51 data source =

转载请注明原文地址:https://www.9cbs.com/read-11441.html

New Post(0)