Re: How to extract db hostname from the $dbh handle?

[email protected] ("Peter J. Holzer")
Newsgroups perl.dbi.users
Message-ID <[email protected]>
On 2010-03-12 18:25:42 -0000, Greg Sabino Mullane wrote:
> > If I have a $dbh handle, is it possible to know which
> > hostname is that $dbh connected to?
> 
> Not in generic DBI, but some drivers (e.g. Postgres via DBD::Pg) 
> provide a custom attribute:
> 
> my $host = $dbh->{pg_host};
> 
> If your driver doesn't have that, bug the author, or perhaps 
> even petition to have it added to DBI.

This may not be possible in the general case. For some databases (e.g.,
Oracle, probably ODBC) you pass in an opaque identifier which is
resolved by the library, not the DBD.

        hp

-- 
   _  | Peter J. Holzer    | Auf jedem Computer sollte der Satz Ludwigs II
|_|_) | Sysadmin WSR       | eingeprägt stehen: "Ein ewig Rätsel will ich
| |   | [email protected]      | bleiben, mir und andern."
__/   | http://www.hjp.at/ |    -- Wolfram Heinrich in desd
signature.asc (application/pgp-signature, 189 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)

iD8DBQFLni/8MdFfQa64PCwRAjbvAJ4kbkQU2K8myN57I53ZWc9lepgPngCfUAAR
jzCZj5PF5TLvNjiUioHyzTM=
=k0tl
-----END PGP SIGNATURE-----
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.