I am seeking for your wisdom because I have a strange connectivity problem with DBI and an Oracle 11.2.0.3 server.
First of all, a disclosure: I am not experienced in Oracle. So, here is my problem:
When I try to connect using the usual dsn/user/password format, thus (according to my understanding) basing the connection on the tnsnames.ora conf file, I obtain the following connection error:
ORA-12505: TNS:listener does not currently know of SID given in connect descriptor.
But when I connect using an alternative parameter format and reproduce the exact entry of the tnsnames.ora file in my code, as a string, then I am able to connect.
By the way, the tnsnames.ora file seems to be ok, as the Oracle SQL Developper client can use it successfully to connect.
Does any person with Oracle experience have any ideas about why this is happening ?
Thank you in advance for your feedback.
Here is the code I am using:
use v5.12; use strict; use warnings; use diagnostics; use DBI; my $dbh; # This code produces an ORA-12505 error $dbh = DBI->connect( "DBI:Oracle:sid=JUPITER;host=jupitercluster", "user", "pass", ); # Alternatively, this code, # reproducting the content of tnsnames.ora, works ! $dbh = DBI->connect( "DBI:Oracle:", "user/pass@(DESCRIPTION =(ADDRESS = (PROTOCOL = TCP)(HOST = jupite +rcluster)(PORT = 1521))(CONNECT_DATA = (SERVER = DEDICATED)(SERVICE_N +AME = jupiter)))", ); __END__ # Content of the entry in tnsnames.ora JUPITER = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = jupitercluster)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME=jupiter) ) )
In reply to DBI and Oracle ORA-12505 error by jmb
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |