in reply to Re: [OT] Get the database name in Oracle
in thread [OT] Get the database name in Oracle

I can able to understand what you're saying and i don't know much about Oracle.
if you look into the DBD::ORACLE ,
use DBI; $dbh = DBI->connect("dbi:Oracle:$dbname",$user,$passwd);
What's the meaning of  $dbname here ? . when i invoke sqlplus usr/pwd , then it entered into some database.i donno which one..Just i want to know before i put my hands on this.
-kulls

Replies are listed 'Best First'.
Re^3: [OT] Get the database name in Oracle
by astroboy (Chaplain) on Jan 03, 2006 at 09:42 UTC

    Well, in this context dbname isn't the name of your database, but a tnsname (which may be in a local tnsnames.ora file, your Oracle Names server or on an LDAP server). In other words the tnsname is a shorthand descriptor for the connection parameters to your database (including protocol, host or ip address, etc) It *may* (and usually does) have tha same name as your database, but this isn't required

    If all you want to do is get your connect name, it should be in $dbh->{Name} (I don't have ready access to Oracle at the moment, but I tested that it works for MySQL). Otherwise, get your DBA to give you access to v$database, and you can query the real db name from there.