local tnsnames.ora not referenced
- From: "tj" <tjyang2001@xxxxxxxxx>
- Date: 19 Jul 2005 09:39:04 -0700
I am supporting DBD::Oracle and I don't know enough on oracle side to
answer a
few questions below.
Background information.
1. I bind the DBD::Oracle with oracle 8.1.7 network libray and
put those library into /opt/oracle/dbd
.@myhost> ls -l /opt/oracle/dbd
total 18
-rwxr-xr-x 1 root root 1962 Jul 8 2004 dbdoracle-test.pl
drwxr-xr-x 3 root other 2560 Jul 8 2004 lib
drwxr-xr-x 15 root other 512 Jul 8 2004 network
drwxr-xr-x 13 root other 512 Jul 8 2004 rdbms
drwxr-xr-x 7 root other 512 Jul 8 2004 sqlplus
..@myhost>
2. Script on Client side. manual edited.
..@myhost> cat /tmp/tj2.pl
#!/usr/bin/perl
use DBI;
$ENV{'ORACLE_SID'}="FFR";
$ENV{'ORACLE_HOME'}="/opt/oracle/dbd";
my $dbh =
DBI->connect('dbi:Oracle:my_ffr.test.com','account/password','') || die
"Failed to open database: $!";
my $query1 = $dbh->prepare("select sysdate from dual");
$query1->execute;
$row=$query1->fetchrow_array();
print "$row\n";
warn $DBI::errstr if $DBI::err;
$query1->finish;
..@myhost>
3. This tj4.pl failed, I put in wrong hostname to demostrate the error
message.
..@myhost> perl /tmp/tj4.pl
DBI->connect(mymy_ffr.test.com) failed: ORA-12154: TNS:could not
resolve service name (DBD ERROR: OCIServerAttach) at /tmp/tj4.pl line 5
Failed to open database: at /tmp/tj4.pl line 5.
..@myhost>
4. If I add an tns entry on oracle server(my_ffr.test.com) then tj2.pl
will work, the system date is displayed.
..@myhost> perl /tmp/tj2.pl
19-jul-2005
..@myhost>
5. following is the tns entry I added into tnsnames.ora
< my_ffr.test.com =
< (DESCRIPTION =
< (ADDRESS = (PROTOCOL= TCP)(Host= fqdn.test.com)(Port= 1521)
< )
< (CONNECT_DATA =
< (SERVER = DEDICATED)
< (SERVICE_NAME = my_ffr.test.com)
< )
< )
Now the questions
Q1. why the local tnsnames.ora has no effect at all ? I have to
add tns entry on oracle server side.
..@myhost> ls -l /opt/oracle/dbd/network/admin/tnsnames.ora
-rw-r--r-- 1 root other 8963 Jul 18 16:48
/opt/oracle/dbd/network/admin/tnsnames.ora
..@myhost>
This behavior my be a good thing for security reason but I
am curious how I can direct DBD::Oracle to look at local
tnsnames.ora
first
Q2. After tj2.pl connect to my_ffr oracle sucessfully, the added
tns entry were commented out.
Why tj2.pl will not fail !? is listener on oracle server reading
entry in tnsnames.ora accumulativly ? even entry in tnsname.ora got
commented out, it still accept connection from tj2.pl ?
Q3. I am making a DBD::Oracle client as an package and need to include
some of the network/lib files. Anyone know what exact file under
network and lib are need to gurantee DBD::Oracle works ?
I appreicate your time
T.J. Yang
.
- Follow-Ups:
- Prev by Date: Re: DB2 connection question
- Next by Date: Re: DBD::Informix Build Error On 64bit AIX 5.2
- Previous by thread: DB2 connection question
- Next by thread: Re: local tnsnames.ora not referenced
- Index(es):
Relevant Pages
|
|