Page 1 of 1

Multiple connections

Posted: Wed Feb 21, 2007 1:11 pm
by user___
Hu guys.,
I am developing an application that needs to connect to some databases (not as usuall to one). I have developed a class that swaps between the two databases by first closing the first database and then opens the second and finally close the second and opens the first. I wonder whether this is the best approach and whether this is the best approach and whether it consumes a lot of power?

Posted: Wed Feb 21, 2007 1:46 pm
by feyd
Do you use the same connection parameters for both? Parameters being username, password, server string and port. If so, you can query the database without changing the current one.

Code: Select all

SELECT fieldName from databaseName.tableName ...

Reply

Posted: Wed Feb 21, 2007 2:25 pm
by user___
Actually, it was not the case to use the same username and password... but I modified my script and now it is.
BTW, sometimes simple things just slip from my mind.
Thank you, feyd.