Subject: | /etc/tnsnames.ora not being read, needs to be added to search path |
Date: | Wed, 4 May 2011 11:05:25 -0400 |
To: | bug-DBD-Oracle [...] rt.cpan.org |
From: | Jay Senseman <jay.senseman [...] gmail.com> |
Currently, if /etc/tnsnames.ora exists on a server, DBD::Oracle (1.28) will
not pull the path in and read the file.
sqlplus appears to allow /etc as a valid path for tnsnames.ora and I
have confirmed that sqlplus will check for and read /etc/tnsnames.ora
on the 11.2 instantclient on RHEL6. I have not been able to find exact docs to
confirm the locations is a valid path, but I have found references to
it in various places within oracle proper:
http://asktom.oracle.com/pls/apex/f?p=100:11:0::NO::P11_QUESTION_ID:1281675938015
http://wiki.oracle.com/page/SQL+Developer+FAQ
"for HP and Digital machines these files [tnsnames.ora] are found in
/etc/ area by default."
Here's a quick one-line patch to add it to the search path:
--- Oracle.pm 2011-05-03 21:01:10.000000000 +0000
+++ Oracle.pm.patch 2011-05-04 14:37:14.000000000 +0000
@@ -147,6 +147,7 @@
"$oracle_home/net80/admin", # OCI 8.0
) if $oracle_home;
push @tns_admin, "/var/opt/oracle";
+ push @tns_admin, "/etc";
foreach $d ( DBD::Oracle::ora_env_var("TNS_ADMIN"), ".", @tns_admin ) {
next unless $d && open(FH, "<$d/tnsnames.ora");
$drh->trace_msg("Loading $d/tnsnames.ora\n") if $debug;
I would appreciate it if this could get added into the next release,
as currently I'm using a symlink /var/opt/oracle -> /etc as my
workaround.