远程连接access数据库的几个方法:
1.建立VPN(Virtual Private Network),这样你的电脑和主机的连接就与局域网无异,然后把服务器中mdb文件所在的Folder共享即可。ADO连接如下:
oConn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=//ServerName/DatabaseFolder/Database.mdb;Jet OLEDB:Database Password=databasepw;Persist Security Info=False"
2.把Database放在Web Server上,使ADO或RDO通过RDS(Remote Data Service)及IIS来实现:
如果服务器像上面Jave大侠说那样设置了ODBC DSN的话:
oConn.Open "Provider=MS Remote;" & _
"Remote Server=http://myServerName;" & _
"Remote Provider=MSDASQL;" & _
"DSN=AdvWorks;" & _
"Uid=myUsername;" & _
"Pwd=myPassword"
如果设置的是OLE DB Provider 的话:
oConn.Open "Provider=MS Remote;" & _
"Remote Server=http://myServerName;" & _
"Remote Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=c:/somepath/mydb.mdb", _
"admin", ""
3.自己编写服务器程序,通过TCP/IP,传递Recordset。
4.使用第三方控件,如:ADO Anywhere或UDAParts RDB等。具体查看
http://www.adoanywhere.com
http://www.udaparts.com/
5.使用XMLHTTP
--------------------------------------
附 远程连接SQL Server的方法:
ConnStr = "Provider=SQLOLEDB.1;Network Library=DBMSSOCN;Persist Security Info=True;User ID=UserName;Password=Password;Initial Catalog=远程数据库名;Data Source=203.129.92.1"
新闻热点
疑难解答