Wrox Programmer Forums
|
Classic ASP Databases Discuss using ASP 3 to work with data in databases, including ASP Database Setup issues from the old P2P forum on this specific subtopic. See also the book forum Beginning ASP.NET Databases for questions specific to that book. NOT for ASP.NET 1.0, 1.1, or 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Databases section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 9th, 2004, 03:15 AM
Authorized User
 
Join Date: Jul 2003
Posts: 17
Thanks: 0
Thanked 0 Times in 0 Posts
Default multiple database connections

hi
I have an online application that is currently being upgraded, the problem is that before i had all my files in a single database but now i have to connect to at least 2 but most likely 3 databases as i am linking into another system. there is no was to integrate the databases into one so it is up to me to make the changes to my code. i was wondering if there are any reasons why i cannot connect to 2,3 or more databases at one time? database is visual foxpro.
Slán
~M
____
Mark
 
Old September 9th, 2004, 04:00 AM
Authorized User
 
Join Date: Aug 2004
Posts: 60
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to sinapra Send a message via MSN to sinapra Send a message via Yahoo to sinapra
Default

I am not sure how to do it for foxpro, but you can certainly connect to many DBs located in multiple servers, local server. If local server, you can simply add a new form where you will have all the connections declared, then use a stored procedure and connect to the database depending upon the relations. If on remote server, you can use linked_servers.
Regards

sinapra
 
Old September 9th, 2004, 04:19 AM
Friend of Wrox
 
Join Date: Jun 2004
Posts: 331
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to qazi_nomi
Default

AS for as the databse connection is concern you can made them in one page and the matter is thing that you mention the name of the databse at making the connection between with the database

(*_*)



Numan
--------------------------------------------------
Love is the most precious thing of this world. So find and grab it!
 
Old September 9th, 2004, 04:25 AM
Authorized User
 
Join Date: Aug 2004
Posts: 60
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to sinapra Send a message via MSN to sinapra Send a message via Yahoo to sinapra
Default

yes db.table...... that could be a way if your dbs are in same server

sinapra
 
Old September 9th, 2004, 04:57 AM
Authorized User
 
Join Date: Jul 2003
Posts: 17
Thanks: 0
Thanked 0 Times in 0 Posts
Default

sorry i should provide more information although i think that from what you are all saying this should not be a problem. i have about 60-70 asp pages all linking into the database. i have one page, connect.asp, that contains the connection string and i include this at the top of all pages. i want to include 2 or 3 connection strings in this file and still be able to connect to any table/database on the 60-70 pages at any time. what has me confused it that should i have to close the connection to db1 before trying to access bd2 or can they all be open at the same time? all databases will be on the same machine but they will be in different folders and different drives.
Slán
~M
____
Mark
 
Old September 9th, 2004, 05:07 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

Hey Mark,

Do you mean to joining different DBFs(tables) from different databases?

Though I am not so good at visual foxpro(having worked with older versions of foxpro), I would suggest you to read about Views. You could get that to work using views. Check msdn on views. That should help you.

Working with Views

Hope that helps.
Cheers!

_________________________
- Vijay G
Strive for Perfection
 
Old September 9th, 2004, 05:09 AM
Authorized User
 
Join Date: Aug 2004
Posts: 60
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to sinapra Send a message via MSN to sinapra Send a message via Yahoo to sinapra
Default

Its always a good practice to close the connections, that is, if you are using two different DBs means you need to open both of them seperately. After the output is given, you must close the connections in order as they execute. So connect.asp will only have connection strings and connections are made open in all the subsequent pages that make the call to connection string. I hope it clears the doubt now.
Try to put minimum burden on your server since more the connections, more will be the load.
Regards

sinapra
 
Old September 9th, 2004, 05:15 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

Quote:
quote:Originally posted by markhardiman
 sorry i should provide more information although i think that from what you are all saying this should not be a problem. ... all databases will be on the same machine but they will be in different folders and different drives.


You can have them all open as long as the web server is good at handling it. But it is always a good practice to close the connection once you are done manipulating with its data, so as to free up resource and can open that up only when needed.

Hope that is what you are looking for.
Cheers!

_________________________
- Vijay G
Strive for Perfection





Similar Threads
Thread Thread Starter Forum Replies Last Post
Multiple Database Connections rit01 ASP.NET 1.x and 2.0 Application Design 6 September 20th, 2006 12:42 PM
Database - connections gkn Oracle 1 December 20th, 2005 08:25 AM
Database - connections gkn Oracle 0 December 20th, 2005 07:27 AM
MS Access database connections proud900 BOOK: ASP.NET Website Programming Problem-Design-Solution 1 June 22nd, 2005 08:21 PM
Multiple Connections to dBase derekinit Classic ASP Databases 0 June 3rd, 2005 09:35 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.