On Fri, 12 Mar 2010 17:02:23 +0100, Ken Youens-Clark <[email protected]> wrote:

On Thu, Mar 11, 2010 at 5:54 AM, Cosimo Streppone <[email protected]> wrote:

If I have a $dbh handle, is it possible to know which
hostname is that $dbh connected to?

I use DBI::parse_dsn and then examine the "driver_dsn" string it
returns.  Since I pretty much only use MySQL, I know I can look for
the "host=foo" part of that:

Thanks Ken.

However, the condition here is that I only have the $dbh.
I don't have the DSN that created that $dbh.

This is a particular piece of legacy code, that I'd not
like to change too much to add metadata, etc..
So I was just wondering if there was a way, something
like:

   $dbh->{Hostname}

or something along the lines...

--
Cosimo

Reply via email to