Re: Retrieving the CURRENT default database name

Michael Nhan <[email protected]>
Newsgroups gmane.comp.lang.perl.modules.dbi.general
Message-ID <[email protected]>
http://dev.mysql.com/doc/refman/5.0/en/information-functions.html#function_database

A simple "select database();" returns the current active database.

Does that not do what you want?


michael



On Mon, 22 Oct 2012, Meir Guttman wrote:

> Date: Mon, 22 Oct 2012 19:19:24 +0200
> From: Meir Guttman <[email protected]>
> To: [email protected]
> Subject: Retrieving the CURRENT default database name
> 
> Dear mavens,
> My application interacts with a MySQL DBMS. There I am using subroutines and
> packages that set the various attributes passed to the DBI "connect" method.
> Also, I later switch databases based on a user's input by executing a "USE
> 'DB_name'" SQL statement.
> What I am after is a way to debug my application and/or log a particular run
> to verify what was actually selected as the "default database name" at any
> given juncture. A bug there might be devastating....
> Unfortunately, a real SQL maven says
> (http://forums.mysql.com/read.php?10,571841,571848) that no SQL statement
> exists to retrieve the currently set database.
> I searched the web to find a way to do so, without success. Is there a DBI
> (or DBD?) way to do so?
> Regards
> Meir
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.