Hi,
i wrote a script which uses the connection method you describe like this:
To connect to a local database with a user which has been set-up to
authenticate via the OS ("ALTER USER username IDENTIFIED EXTERNALLY"):
$dbh = DBI->connect('dbi:Oracle:','/','');
Note the lack of a connection name (use the ORACLE_SID environment
variable).
My tnsnames.ora looks like:
BBA =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = dhcp-144.int.consol.de)(PORT = 1521))
.....
"tnsping bba" worked fine, but my perl-script (where is set $ENV{ORACLE_SID}
= "bba") always said:
CRITICAL - cannot connect to . ORA-01034: ORACLE not available
ORA-27101: shared memory realm does not exist
Linux Error: 2: No such file or directory (DBD ERROR: OCISessionBegin)
What i didn't know, tnsping seems to try also the upper case, that's why i
blindly set ORACLE_SID also to "bba".
Now, 13 hours later (reading half of the internet, reading process and
network traces), i accidentially typed the ORACLE_SID in upper case and it
worked.
In order to save other people from spending hours in desperation, i propose
to add a warning message on the cpan webpage:
The ORACLE_SID is case sensitive, use the exact copy of the value from
tnsnames.ora!
Greetings from Munich,
Gerhard