Without DSN访问ISP的数据库拼盘

发表于:2007-06-30来源:作者:点击数: 标签:
除非你用远程登录软件Logon ISP的 服务器 ,否则你是没有办法通过DSN连接 数据库 。下面介绍几种连接方法,让你超越与你的ISP之间的空间距离,让你连接数据库变得简单: 1.SQL Server % cstr = Provider=SQLOLEDB;Server=ip address;database=dbname; cstr = c
除非你用远程登录软件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. Aclearcase/" target="_blank" >ccess

<%
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
%>

原文转自:http://www.ltesting.net