Re: multiple database users

[prev] [thread] [next] [Date index for 2005/06/06]

From: William Ross
Subject: Re: multiple database users
Date: 15:30 on 06 Jun 2005
On 6 Jun 2005, at 15:03, Hartmaier Alexander wrote:

> I think I found a typo at
> http://wiki.class-dbi.com/index.cgi?UsingMultipleDatabases
> 'return $g_database_handles{$db_group};'
> should be
> 'return $g_database_handles{$connection_key};'
>
> Can somebody confirm this? Than I change it in the wiki...

yes, I think you're right.

> What I don't get is what is meant with '# in some other file'...

I think it means that you will be using your own configuration  
mechanism to supply the database connection parameters. It isn't very  
clear.

> I use my CDBI class for different scripts and also two different  
> webpages
> (same database, different db users).
> Because the scripts run on the same box I can't use (and I also  
> don't like
> to) use environment variables to choose the db connection.

So. How do you know which user's site is currently being browsed? Use  
that.

> The db usernames and passwords are in a config file I load with
> Config::Simple which returns a hash.
> The only problem I have with the example is that I want to set the var
> '$connection_key' when loading the CDBI module.

then I would respectfully suggest that you stop worrying and set the  
variable.

will


ps. there are reasons why an environment variable is commonly used  
for this purpose:

1. you don't have access to very much information from db_Main. You  
can't pass parameters to it and it isn't an object method, so you  
only have access to %ENV, globals (bites you under mod_perl) and  
package variables (which is where we started).

2. db_Main gets called very very often, so you don't want to do  
anything complicated.


multiple database users
Hartmaier Alexander 17:43 on 02 Jun 2005

Re: multiple database users
Andreas Fromm 07:13 on 03 Jun 2005

Re: multiple database users
William Ross 08:42 on 03 Jun 2005

Re: multiple database users
Hartmaier Alexander 10:29 on 06 Jun 2005

Re: multiple database users
Mark Addison 11:20 on 06 Jun 2005

Re: multiple database users
William Ross 11:39 on 06 Jun 2005

Re: multiple database users
Tony Bowden 13:09 on 06 Jun 2005

Re: multiple database users
Mark Addison 13:34 on 06 Jun 2005

Re: multiple database users
Perrin Harkins 14:30 on 06 Jun 2005

Re: multiple database users
Hartmaier Alexander 11:31 on 06 Jun 2005

Re: multiple database users
Hartmaier Alexander 11:51 on 06 Jun 2005

Re: multiple database users
William Ross 13:46 on 06 Jun 2005

Re: multiple database users
Hartmaier Alexander 14:03 on 06 Jun 2005

Re: multiple database users
William Ross 15:30 on 06 Jun 2005

Re: multiple database users
Hartmaier Alexander 16:44 on 06 Jun 2005

Re: multiple database users
William Ross 18:26 on 06 Jun 2005

Re: multiple database users
Jay Strauss 02:53 on 07 Jun 2005

Re: multiple database users
Perrin Harkins 03:58 on 07 Jun 2005

Re: multiple database users
William Ross 10:23 on 07 Jun 2005

Re: multiple database users
Hartmaier Alexander 09:28 on 07 Jun 2005

Re: multiple database users
Perrin Harkins 12:49 on 07 Jun 2005

Re: multiple database users
Hartmaier Alexander 12:49 on 07 Jun 2005

Re: multiple database users
Perrin Harkins 12:54 on 07 Jun 2005

Re: multiple database users
Hartmaier Alexander 13:02 on 07 Jun 2005

Re: multiple database users
Mark Addison 13:47 on 07 Jun 2005

Generated at 16:35 on 28 Jul 2005 by mariachi v0.52