本人原本通过ADO连接Internet上的SQL数据库,但是速度非常慢。想请问一下怎么通过RDS(Remote Data Services)”方式进行连接?是否速度会快一些?
因为我听说使用RDS的话,数据库连接、查询及更新都是在服务器上完成,也相当于像ASP
一样在服务器本机上操作,是否真是这么回事呢?那应该怎么进行连接呢?望各位高手赐教,立即给分!谢谢!
因为我听说使用RDS的话,数据库连接、查询及更新都是在服务器上完成,也相当于像ASP
一样在服务器本机上操作,是否真是这么回事呢?那应该怎么进行连接呢?望各位高手赐教,立即给分!谢谢!
When using the RDS DataControl's Server/SQL/Connect properties, the RDS DataControl uses the
RDS DataFactory on the remote server. If you use the RDS DataControl's URL property,
then the RDS DataFactory is not used at all.WARNING: The RDS DataFactory can be a major security hole if not setup and configured correctly!
For more information, see RDS FAQ #24 RDS DataControl - Connect Property
With the RDS default handler disabled (not recommend due to security risks):With oRdc
.Server = "http://carl2";
.Sql = "Select * From Authors Where State = 'CA'"
.Connect = "Provider=sqloledb;" & _
"Data Source=(local);" & _
"Initial Catalog=pubs;" & _
"User Id=sa;" & _
"Password=;"
.Refresh
End WithWith the RDS default handler enabled (recommend):With oRdc
.Server = "http://carl2";
.Handler = "MSDFMAP.Handler"
.Connect = "Data Source=MyConnectTag;"
.Sql = "MySQLTag(""CA"""
.Refresh
End With The corresponding CONNECT and SQL sections in the default handler \WINNT\MSDFMAP.INI file would be:[connect MyConnectTag]
Access = ReadWrite
Connect = "Provider=sqloledb;Data Source=(local);Initial Catalog=pubs;User Id=sa;Password=;" [sql MySQLTag]
Sql = "Select * From Authors Where State = '?'"For more information about the RDS Default Handler, see:
Q243245, Q230680, and RDS Customization Handler Microsoft articles
RDS DataControl - URL Property
To get records from a remote database:With oRdc
.URL = "http://carlp0/Authors_GetByState.asp?state=CA";
.Refresh
End WithTo save, set the URL property to an ASP web page:With oRdc
.URL = "http://carlp0/rdsdatacontrol/Authors_Save.asp";
.SubmitChanges
End WithFor more information, see: RDS URL Property
ADO URL Connections
ADO 2.5+ allows you to open up a Recordset based on XML returned from an ASP file over HTTP.
This feature doesn't use RDS at all.ADO Recordset
To get records from a remote database:oRs.Open "http://carlp0/Authors_GetByState.asp?state=CA";, , _
adOpenStatic, adLockBatchOptimistic To save changes, you must use the MSXML's XMLHTTP object to POST back the updated XML.
The Recordset's Update and UpdateBatch methods will not work in this case.' Save Recordset into Stream
Set oStm = New ADODB.Stream
oRs.Save oStm, adPersistXML' Use MSXML's XMLHTTP object to open ASP and post a XML stream
Set oXMLHTTP = New MSXML2.XMLHTTP30
oXMLHTTP.Open "POST", "http://carlp0/Authors_Save.asp";, False
oXMLHTTP.Send oStm.ReadText' If an error occurred
If oXMLHTTP.Status = 500 Then
Debug.Print oXMLHTTP.statusText
End IfFor more information, see: ADO Recordset's Open Method