Re: DBI MySQL Use Another DB Without Disconnecting
- From: Brian Wakem <no@xxxxxxxxx>
- Date: Thu, 28 Jul 2005 23:32:22 +0100
afrinspray wrote:
> Is there a way to change the database in a DBI mysql connection without
> disconnecting? For example, in PHP you'd just say
>
> mysql_select_db("db_name_here", $dbh)
>
> I looked through the DBI code on cpan and I didn't see anything, but
> I'm falling asleep here at work, so maybe I missed it. :)
>
> Thanks,
> Mike
You can do it quite easily, but the user needs permission to do stuff on the
other database. Personally I have a different user for each DB so I can't
do this myself (if somebody gets with access to the machine gets hold of a
user/pass they can only access 1 DB).
You change it exactly as you would if you were logged in at the command
line:-
use db_name
--
Brian Wakem
.
- Follow-Ups:
- Re: DBI MySQL Use Another DB Without Disconnecting
- From: afrinspray
- Re: DBI MySQL Use Another DB Without Disconnecting
- References:
- DBI MySQL Use Another DB Without Disconnecting
- From: afrinspray
- DBI MySQL Use Another DB Without Disconnecting
- Prev by Date: Re: Perl DBI - How to handle large resultsets?
- Next by Date: Re: multidimensional insertion order
- Previous by thread: DBI MySQL Use Another DB Without Disconnecting
- Next by thread: Re: DBI MySQL Use Another DB Without Disconnecting
- Index(es):
Relevant Pages
|