How the database is linked (i)

Source: Internet
Author: User
Tags dsn odbc sql
Links | data | database
How the database is linked (i)

(ODBC article)

1. Production:


Database
Early database connectivity is very difficult. Because the format of the various databases is different, developers have to have a deep understanding of the underlying APIs for each database they develop. As a result, a common API that handles a wide variety of databases comes into-―ODBC (Open database Connectivity), an early product of people creating generic APIs. You can use the same code to access different data products in your program, so there are a number of databases (such as access, Ms-sql Server, Oracle, Informix, etc.) that conform to this standard and are called ODBC-compliant databases. The specific role of ODBC is shown in the figure:











In general, ODBC consists of an extended set of DLLs (dynamic link library DLL), which provides a standard database application design interface. ODBC is based on a standardized SQL (Structuredquerylanguage, Structured Query language). So with ODBC and SQL, you can write data access programs that are independent of any database product.

2. Connect 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.

When using them in ASP, the following are written:

A. Linked SQL Server:

Using System DSN:

Connstr= "Dsn=dsnname; Uid=xx; Pwd=xxx;database=dbname "

To use a file 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. Link Access:

Using System DSN:

Connstr= "Dsn=dsnname"

(or for: connstr= "dsn=dsnname; Uid=xx; Pwd=xxx ")

To use a file DSN:

Connstr= "Filedsn=xx"

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, defects:

ODBC contains a large number of low-level calls, so developing an ODBC application is also difficult. Developers have to devote a lot of their energy to the underlying database communications and not focus on the data they are working on.


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.