Re: DBI MySQL Use Another DB Without Disconnecting



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

.



Relevant Pages

  • DBI MySQL Use Another DB Without Disconnecting
    ... Is there a way to change the database in a DBI mysql connection without ... in PHP you'd just say ...
    (comp.lang.perl.misc)
  • Re: DB connection PB.
    ... When you use an Access database within ASP .NET, ... the ASPNET user needs permission to read/write to the database ...
    (microsoft.public.dotnet.academic)
  • Error 916: Server user X is not a valid user in database X
    ... We have 20 databases on our SQL 2000 Server. ... table in the database 'AAA' and selects All tasks>Generate ... SQL Script in Enterprise Manager he gets an error message. ... always states that the user needs permission to the ...
    (microsoft.public.sqlserver.security)