> Mark Stosberg wrote:
>
> Eduardo Grosclaude wrote:
> >
> > Curtis, Thank you lots!
> >
> > > ( $q = $self->query() assumed before this)
> > Yes
> >
> > > > $self->param('BASE' => $q->param('base'));
> > > > $self->param('USER' => $q->param('user'));
> > > > $self->param('PASS' => $q->param('pass'));
> > > > my $dsrc = "DBI:mysql:".$self->param('BASE');
> > > > $self->param('DBH' => DBI->connect($dsrc,
> > > > $self->param('USER'),
> > > > $self->param('PASS'),
> > > > {RaiseError=>1}));
> > >
> > > This is in setup(), correct? NOT in a run mode? If it is in a
> run mode,
> > > you're in trouble.
> > How can I properly send users' identity to the database engine then?
>
> Usually with web apps, I connect the database as the same user the whole
> time, but might treat
> users differently by looking up their information in a "users" table
> I've created.
>
I'd just like to add an extra word of caution. If you use Apache::DBI for
persistance, database handles are 'kept alive'. Consider your case Eduardo,
logging each user into the DBMS individually.
Let's say you have 50 users on the site at one time, and Apache has spawned
around 20 children to deal with them. Each user will create a database
handle on every child it happens to hit. In a worst case scenario this is
1000 handles! And that's for a very small load. Compare that to the 20 or so
handles a generic login would generate.
There's nothing intrinsically wrong with individual logins -- in some cases
it might be the best solution -- but Mark's suggestion of a 'generic' login
allows connections to be pooled (among other benefits).
For more info on Apache::DBI visit
http://search.cpan.org/search?mode=module&query=Apache::DBI .
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]