asp连接access数据库与MySQL数据库


Access数据库

access数据库有两种文件,​​*.mdb​​​,​​*.accdb​

1. *.mdb

db="test.mdb" 
Set conn = Server.CreateObject("ADODB.Connection")
connstr="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath(db)
conn.Open connstr

2.*.accdb

<%
dim conn2,connstr2,db2
db2="/db/student.accdb"
Set conn2 = Server.CreateObject("ADODB.Connection")
connstr2="Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & Server.MapPath(db2)
conn2.Open connstr
conn2.Close
%>

3.MySQL

Set conn = Server.CreateObject("ADODB.Connection")
conn.Open "driver={MySQL ODBC 8.0 ANSI Driver};server=10.205.199.74;uid=root;pwd=root;database=databasename;prot=3306"