远程连接access数据库的三种方法

手册/FAQ (643) 2016-04-12 10:50:46

 

1.建立(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。 

THE END