schluckie has asked for the wisdom of the Perl Monks concerning the following question:
Please enlighten me! Why does the first DBI->Connect work and does the second DBI->Connect throw an ORA-12154?
#!/usr/bin/perl use strict; use DBI; print "DB connectivity test\n"; my $user='system'; my $password='manager'; my $DSN='dbi:Oracle://127.0.0.1:1521/db.company.local'; my $dbh = DBI->connect($DSN, $user, $password, { RaiseError => 1, AutoCommit => 0 }); print "This works\n"; my $DSN='dbi:Oracle:host=127.0.0.1:sid=db.company.local:port=1521'; my $dbh = DBI->connect($DSN, $user, $password, { RaiseError => 1, AutoCommit => 0 }); print "This doesn't\n";
Running the code yields the following result:
DB connectivity test This works DBI connect('host=127.0.0.1:sid=ps.kadaster.local:port=1521','system', +...) failed: ORA-12154: TNS:could not resolve the connect identifier +specified (DBD ERROR: OCIServerAttach) at conn_test.pl line 16.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: DB Connectivity issue
by Tux (Canon) on Jun 01, 2016 at 05:46 UTC | |
|
Re: DB Connectivity issue
by stevieb (Canon) on May 31, 2016 at 16:23 UTC | |
by schluckie (Initiate) on Jun 01, 2016 at 05:10 UTC | |
|
Re: DB Connectivity issue
by graff (Chancellor) on Jun 01, 2016 at 01:55 UTC |