I know that the "standard" way to access another database is to include it in $db_url in the settigs.php file. This has the undesireable effect that the remote database must be available all the time. In my case, we only need to access the remote DB a few times a week via a cron job, where much better error handling is available. I haven't yet found a way (I'm still searching DO) to do this. Does anyone have any good ideas? This is Drupal 6 - don't bother suggesting an upgrade. Replication is probably not an option because we shouldn't have access to, nor need, everything in the remote DB.
Nancy Injustice anywhere is a threat to justice everywhere. -- Dr. Martin L. King, Jr.
Not clear what the question is. does this help: http://drupal.org/node/18429
On Mon, Jul 11, 2011 at 9:35 PM, Ms. Nancy Wichmann nan_wich@bellsouth.net wrote:
I know that the "standard" way to access another database is to include it in $db_url in the settigs.php file. This has the undesireable effect that the remote database must be available all the time. In my case, we only need to access the remote DB a few times a week via a cron job, where much better error handling is available. I haven't yet found a way (I'm still searching DO) to do this. Does anyone have any good ideas? This is Drupal 6 - don't bother suggesting an upgrade. Replication is probably not an option because we shouldn't have access to, nor need, everything in the remote DB.
Nancy
Injustice anywhere is a threat to justice everywhere. -- Dr. Martin L. King, Jr. -- [ Drupal support list | http://lists.drupal.org/ ]
No, the $db_url method simply will not work because we cannot guarantee that the remote will always be accessible. If it's not, there is no reason why our site should not be. Once in a while (cron), we need to go get some data from that database; if it's not available at that time, we will merely log the error and try later.
Nancy Injustice anywhere is a threat to justice everywhere. -- Dr. Martin L. King, Jr.
From: Fred Jones
Not clear what the question is. does this help: http://drupal.org/node/18429
On Mon, Jul 11, 2011 at 9:35 PM, Ms. Nancy Wichmann wrote:
I know that the "standard" way to access another database is to include it in $db_url in the settigs.php file. This has the undesireable effect that the remote database must be available all the time. In my case, we only need to access the remote DB a few times a week via a cron job, where much better error handling is available. I haven't yet found a way (I'm still searching DO) to do this. Does anyone have any good ideas? This is Drupal 6 - don't bother suggesting an upgrade. Replication is probably not an option because we shouldn't have access to, nor need, everything in the remote DB.
Drupal 6 is pretty much going to ignore any additional (non-default) connections specified, if $db_url is an array(), unless you try to connect. No problem putting the connection string there and using only when you need it. This is even true for DBTNG backport module, although it has other ways of setting up connections after Drupal has boostrapped.
-Mike
Ms. Nancy Wichmann wrote:
No, the $db_url method simply will not work because we cannot guarantee that the remote will always be accessible. If it's not, there is no reason why our site should not be. Once in a while (cron), we need to go get some data from that database; if it's not available at that time, we will merely log the error and try later. /*Nancy*/ Injustice anywhere is a threat to justice everywhere. -- Dr. Martin L. King, Jr.
*From:* Fred Jones Not clear what the question is. does this help: http://drupal.org/node/18429 On Mon, Jul 11, 2011 at 9:35 PM, Ms. Nancy Wichmann wrote: > I know that the "standard" way to access another database is to include it > in $db_url in the settigs.php file. This has the undesireable effect that > the remote database must be available all the time. In my case, we only need > to access the remote DB a few times a week via a cron job, where much better > error handling is available. I haven't yet found a way (I'm still searching > DO) to do this. Does anyone have any good ideas? This is Drupal 6 - don't > bother suggesting an upgrade. Replication is probably not an option because > we shouldn't have access to, nor need, everything in the remote DB.
Not sure how you are accessing your remote db, but it seems odd that it should open a connection before one is required. The settings.php shouldn't cause a connection to the db, it just defines the connection stirng.
It seems that when set_active is called then the conection gets opened. If that only happens in a cron hook then that should only happen then. Where are your set_active calls coming into play here?
Dave
________________________________
From: support-bounces@drupal.org [mailto:support-bounces@drupal.org] On Behalf Of Ms. Nancy Wichmann Sent: Monday, July 11, 2011 11:36 AM To: support drupal Subject: [support] Dynamic remote database access
I know that the "standard" way to access another database is to include it in $db_url in the settigs.php file. This has the undesireable effect that the remote database must be available all the time. In my case, we only need to access the remote DB a few times a week via a cron job, where much better error handling is available. I haven't yet found a way (I'm still searching DO) to do this. Does anyone have any good ideas? This is Drupal 6 - don't bother suggesting an upgrade. Replication is probably not an option because we shouldn't have access to, nor need, everything in the remote DB.
Nancy
Injustice anywhere is a threat to justice everywhere. -- Dr. Martin L. King, Jr.