Connecting to multiple databases...

Results 1 to 2 of 2

Thread: Connecting to multiple databases...

  1. #1
    Join Date
    Dec 1969

    Default Connecting to multiple databases...

    I&#039;m using ASP (JScript) and ADO (Access), and I have a few questions about connecting to multiple databases.<BR><BR>Firstly, I don&#039;t seem to have any problems connecting to two databases. I just use something like this:<BR><BR>
    <BR>var sConnectionString1 = "Data Source=database1.mdb";<BR>var sConnectionString2 = "Data Source=database2.mdb";<BR><BR>oConnection1 = Server.CreateObject ( &#039;ADODB.Connection&#039; );<BR>oConnection2 = Server.CreateObject ( &#039;ADODB.Connection&#039; );<BR><BR>oConnection1.Open ( sConnectionString1 );<BR>oConnection2.Open ( sConnectionString2 );<BR><BR>oRecordSet1 = Server.CreateObject ( &#039;ADODB.Recordset&#039; );<BR>oRecordSet2 = Server.CreateObject ( &#039;ADODB.Recordset&#039; );<BR>
    <BR><BR>...and it seems to be interpreted just fine.<BR><BR>Here are my questions:<BR><BR>1). Do I need those two RecordSets for querys on each db? I&#039;d like to assume that I can create two connections and access them through one RecordSet, as if they were one database (here&#039;s hoping :)<BR><BR>2). If the above is true, how would I differentiate tables with identical names in the two databases? (I don&#039;t, but just for future reference if anyone knows)<BR><BR>3). Any performance issues? The sites I&#039;m working with are relatively low traffic.<BR><BR>Thanks for any help you can give.<BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: Connecting to multiple databases...

    In answer to question one - it is possible to use just one recordset so long as you open the recordset with the first connection, use the recordset, close it and then reopen it with the next connection. In answer to question two - what is the point of using two databases with the same tables in? I&#039;m not sure exactly what you&#039;re asking here. In answer to question three - there aren&#039;t really any performance issues, although its worth knowing that the less ADO objects you use the better as they are pretty resource hungry! Hope that helps.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts