Connecting Tech Pros Worldwide Help | Site Map

How Can i Connect More then one database

 
LinkBack Thread Tools Search this Thread
  #1  
Old March 15th, 2008, 12:35 AM
Damodhar
Guest
 
Posts: n/a
Default How Can i Connect More then one database

hi

how can i connect more then one database in the same project.

  #2  
Old March 15th, 2008, 01:05 AM
Jerry Stuckle
Guest
 
Posts: n/a
Default Re: How Can i Connect More then one database

Damodhar wrote:
Quote:
hi
>
how can i connect more then one database in the same project.
>
Simple - just connect and save the result of the connection. This will
be a resource representing the connection; just use the appropriate
resource in all of your calls (virtually all database function calls
have an optional parameter being the connection resource).

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

  #3  
Old March 15th, 2008, 02:05 AM
Rik Wasmus
Guest
 
Posts: n/a
Default Re: How Can i Connect More then one database

On Sat, 15 Mar 2008 02:57:45 +0100, Jerry Stuckle
<jstucklex@attglobal.netwrote:
Quote:
Damodhar wrote:
Quote:
>hi
> how can i connect more then one database in the same project.
>>
>
Simple - just connect and save the result of the connection. This will
be a resource representing the connection; just use the appropriate
resource in all of your calls (virtually all database function calls
have an optional parameter being the connection resource).
Be aware though: of both databases are on the same database server, and
reachable with the same connection & user, it's often just more lucrative
to use full names for tables in queries, at least in case of MySQL.
--
Rik Wasmus
  #4  
Old March 15th, 2008, 10:55 AM
Dikkie Dik
Guest
 
Posts: n/a
Default Re: How Can i Connect More then one database

Be aware though: of both databases are on the same database server, and
Quote:
reachable with the same connection & user, it's often just more
lucrative to use full names for tables in queries, at least in case of
MySQL.
True. But there are other reasons for multiple connections. I often have
a separate connection to the same database for error logging (lazily
initiated, not open by default). This allows my error handling code to
log errors to a table, even if the main code does a transaction rollback
later.

Best reards.
  #5  
Old March 16th, 2008, 02:35 PM
Michael Fesser
Guest
 
Posts: n/a
Default Re: How Can i Connect More then one database

..oO(The Natural Philosopher)
Quote:
>Jerry Stuckle wrote:
>
Quote:
>Which means you're making multiple links to the database with the same
>credentials, wasting system resources.
>>
>All 1k bytes of them probably. Tsk Tsk.
"Too many connections" is a quite common error, especially on shared
hosts with a lot of poorly written user scripts.

Micha
  #6  
Old March 16th, 2008, 05:55 PM
The Natural Philosopher
Guest
 
Posts: n/a
Default Re: How Can i Connect More then one database

Michael Fesser wrote:
Quote:
.oO(The Natural Philosopher)
>
Quote:
>Jerry Stuckle wrote:
>>
Quote:
>>Which means you're making multiple links to the database with the same
>>credentials, wasting system resources.
>>>
>All 1k bytes of them probably. Tsk Tsk.
>
"Too many connections" is a quite common error, especially on shared
hosts with a lot of poorly written user scripts.
>
Micha
Or poorly tuned kernels..
  #7  
Old March 17th, 2008, 07:45 AM
jamesgoode
Guest
 
Posts: n/a
Default Re: How Can i Connect More then one database

On Mar 15, 12:33 am, Damodhar <damu...@gmail.comwrote:
Quote:
hi
>
how can i connect more then one database in the same project.
$connection = mysql_connect(normal params);
mysql_query(query, $connection);
 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 220,989 network members.