Without DSN访问ISP的数据库拼盘
除非你用远程登录软件Logon ISP的服务器,否则你是没有办法通过DSN连接数据库。下面介绍几种连接方法,让你超越与你的ISP之间的空间距离,让你连接数据库变得简单:1.SQL Server
<%
cstr = "Provider=SQLOLEDB;Server=<ip address>;database=<dbname>;"
cstr = cstr & "network=DBMSSOCN;uid=<uid>;pwd=<pwd>"
set conn = server.createobject("adodb.connection")
conn.open cstr
' 利用Network=DBMSSOCN方式连接可以避免管理命名引起的错误
%>
2.Oracle
<%
cstr = "Provider=OraOLEDB.Oracle;Server=<ip address>;Data "
cstr = cst & "Source=<dbname>;User ID=<uid>;Password=<pwd>"
set conn = server.createobject("adodb.connection")
conn.open cstr
%>
3. Access
<%
cstr = "Driver={Microsoft Access Driver (*.mdb)};DBQ="
cstr = cstr & server.mappath("/<pathtofile.mdb>")
set conn = server.createobject("adodb.connection")
conn.open cstr
%>
4.如果你安装了Jet 4.0,用这种方法连接效果更好.
<%
cstr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="
cstr = cstr & server.mappath("/<pathtofile.mdb>")
set conn = server.createobject("adodb.connection")
conn.open cstr
%>
补充:asp教程,数据库相关