Home > Database > Mysql Tutorial > body text

Summary of common database connection methods

藏色散人
Release: 2019-02-16 17:56:21
Original
3175 people have browsed it

Summary of common database connection methods

1. DSN-less connection method of Access database:

set adocon=Server.Createobject("adodb.connection")
adoconn.Open"Driver={Microsoft Access Driver(*.mdb)};DBQ="& _
Server.MapPath("数据库所在路径")
Copy after login

2.Access OLE DB Connection method:

set adocon=Server.Createobject("adodb.connection")
adocon.open"Provider=Microsoft.Jet.OLEDB.4.0;"& _
"Data Source=" & Server.MapPath("数据库所在路径")
Copy after login

3.SQL server connection method:

set adocon=server.createobject("adodb.recordset")
adocon.Open"Driver={SQL Server};Server=(Local);UID=***;PWD=***;"& _
"database=数据库名;"
Copy after login

4.SQL server OLE DB connection method:

set adocon=Server.Createobject("adodb.connection")
adocon.open"provider=SQLOLEDB.1;Data Source=RITANT4;"& _
"user ID=***;Password=***;"& _
"inital Catalog=数据库名"
Copy after login

5.mySQL connection method:

set adocon=Server.Createobject("adodb.connection")
adocon.open"Driver={mysql};database=yourdatabase;
uid=username;pwd=yourpassword;option=16386;"
Copy after login

Recommended tutorial: "mysql tutorial"//m.sbmmt.com/ course/list/51.html

This article is a summary of common database connection methods. I hope it will be helpful to friends in need!

The above is the detailed content of Summary of common database connection methods. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!