Print Page | Close Window

Three Databases?

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: Classic ASP Discussion
Forum Description: Discussion on Active Server Pages (Classic ASP).
URL: https://forums.webwiz.net/forum_posts.asp?TID=1740
Printed Date: 29 March 2026 at 5:18am
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: Three Databases?
Posted By: pmormr
Subject: Three Databases?
Date Posted: 10 April 2003 at 5:17pm

Is it possible to open up three databases in the same ASP file (three different variables set to Server.CreateObject("ADO etc...) and then open up a recordset for two of them, and use the SQL statement "INSERT INTO" to put the values from the two other databases into one? I'm wondering, with the insert into statement how does it know which database to insert into, is there another field where you can put the database name and the table name or no?

Thanks,
Paul Morgan



-------------
Paul A Morgan

http://www.pmorganphoto.com/" rel="nofollow - http://www.pmorganphoto.com/



Replies:
Posted By: Coco Brown
Date Posted: 11 April 2003 at 4:48pm

yes, you can query over two databases, but you have to link them first.  I would import the table you want from one database into another.  Then query normally between the two tables.  Use that info to create your new Insert SQL query and execute it.

As far as opening three connections, you can open up to 10 connections on the same page without getting an error.  But my way would require you to only use two:  the one you are querying from(that has the imported table), and the other one you are inserting into.

Hope this helps.



Posted By: pmormr
Date Posted: 11 April 2003 at 5:47pm

how do you link the databases?



Posted By: Bunce
Date Posted: 11 April 2003 at 10:47pm

What database are you using.

You can 'link servers' in SQL Server and I imagine there is something similar in Oracel.

If you are using Access then theres a bit more trouble to go to.

Cheers,
Andrew



-------------
There have been many, many posts made throughout the world...
This was one of them.


Posted By: pmormr
Date Posted: 12 April 2003 at 6:36pm
i'm using access 2000

-------------
Paul A Morgan

http://www.pmorganphoto.com/" rel="nofollow - http://www.pmorganphoto.com/


Posted By: Bunce
Date Posted: 12 April 2003 at 7:32pm

Can the databases see each other?

If so, you can link tables from within the database itself. This will probably impact on performance a little, but might be the easier way.

Cheers,
Andrew



-------------
There have been many, many posts made throughout the world...
This was one of them.


Posted By: pmormr
Date Posted: 12 April 2003 at 7:37pm
when you say "see each other" what do you mean?

-------------
Paul A Morgan

http://www.pmorganphoto.com/" rel="nofollow - http://www.pmorganphoto.com/


Posted By: Bunce
Date Posted: 12 April 2003 at 7:45pm

Generally means the same server or through mapped drives etc.

Try it: Open up one of the databases- Insert -> Table -> Linked Table.



-------------
There have been many, many posts made throughout the world...
This was one of them.


Posted By: pmormr
Date Posted: 12 April 2003 at 7:49pm

yes they can see each other



-------------
Paul A Morgan

http://www.pmorganphoto.com/" rel="nofollow - http://www.pmorganphoto.com/


Posted By: Bunce
Date Posted: 13 April 2003 at 12:45am

and you've linked them?



-------------
There have been many, many posts made throughout the world...
This was one of them.


Posted By: pmormr
Date Posted: 13 April 2003 at 9:15am
now i see, now i can open one database and use the linked tables just as if they were all in the same database.

-------------
Paul A Morgan

http://www.pmorganphoto.com/" rel="nofollow - http://www.pmorganphoto.com/


Posted By: pmormr
Date Posted: 13 April 2003 at 9:16am

is there anything special that i have to do to open up the linked databases?

 



-------------
Paul A Morgan

http://www.pmorganphoto.com/" rel="nofollow - http://www.pmorganphoto.com/



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net