By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,784 Members | 2,933 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,784 IT Pros & Developers. It's quick & easy.

multiple database select

100+
P: 268
Hi friends

In my application i need to connect multiple database.First i connect one database and got the value then i connect another database to insert the values . If any possible to two database to connect single application .

Please send me your suggestion .


Thanks
vssp
Jul 26 '06 #1
Share this Question
Share on Google+
3 Replies


iam_clint
Expert 100+
P: 1,208
depends on the application and language its written in.
Jul 26 '06 #2

ronverdonk
Expert 2.5K+
P: 4,258
Following is a quote from an entry in the php.net documentation for mysql_select_db:

matsko at rogers dot com 10-May-2006 09:19
Just incase the mysql_select_db() function still won't work with multiple database connections (as has happened to me before).

$dbh1 = mysql_pconnect($host,$user,$pass);
$dbh2 = mysql_pconnect($host,$user,$pass);

You could do this...

mysql_query("USE database1",$dbh1);
mysql_query("Use database2",$dbh2);

This does the same thing as the mysql_select_db() function...

or this...

You don't even have to select the database for each connection.

mysql_query("SELECT * FROM database1.table",$dbh1);
mysql_query("SELECT * FROM database2.table",$dbh2);
Ronald :cool:
Aug 4 '06 #3

100+
P: 268
Thanks friends
Aug 24 '06 #4

Post your reply

Sign in to post your reply or Sign up for a free account.