Well then I'm not sure, except to say why ODBC? I'm not sure you can equate sqlplus and odbc. Sqlplus uses sqlnet to connect while odbc uses ... not sure. Do you not have an oracle client installed on your box? Can't you put your sqlplus connection string into the oracle tnsnames.ora file so you could connect like ....? my $dbh = DBI->connect("dbi:Oracle:$tnsname", $user, $pass);
I also highly recommend that you use the 4th argument of the connect and turn on RaiseError, like this.... my $dbh = DBI->connect("dbi:Oracle:$tnsname", $user, $pass, {RaiseError => 1}); ... so you can 'catch' errors with an eval instead of having to test for it manually. This will make your code much cleaner. Another option might be to run on trace levels. This spits out a whole lotta stuff that may or may not be useful in deducing your problem. I'm pretty sure the levels are 1 - 5 where 5 is the most annoying. DBI->trace($trace_level) DBI->trace($trace_level, $trace_filename) -----Original Message----- From: Scott Stansbury [mailto:sstansb...@aol.com] Sent: Wednesday, October 05, 2011 9:22 AM To: Nelson, Erick [HDS] Cc: dbi-users@perl.org Subject: Re: :ODBC fails, SQL*Plus works I'm sorry - that was just fat fingers on the cut/paste... In actuality it is $oracle_host = "192.168.15.200:1535" On Oct 5, 2011, at 12:13 PM, Nelson, Erick [HDS] wrote: > Your $oracle_host Perl var looks like it has more that just the host ip > address and port in it. What is the 10.128 ? > > -----Original Message----- > From: Scott Stansbury [mailto:sstansb...@aol.com] > Sent: Wednesday, October 05, 2011 9:09 AM > To: dbi-users@perl.org > Subject: DBD::ODBC fails, SQL*Plus works > > Folks, > > I could use a tip or lead with the following issue: > > I have a Windows Server 2008 R2 box with Oracle Instant Client 11.2, > with the SQL*Plus and ODBC modules installed. No other Oracle software > is installed. > > I am connecting to an Oracle 10g instance. The following SQL*Plus works: > > sqlplus > user/passwd@(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=192. > 168.15.200)(PORT=1535)))(CONNECT_DATA=(SID=PROD77))). > > The perl script that contains the following does not: > > use DBI; > > # Oracle / Remedy info > > my $oracle_sid = "PROD77"; > my $oracle_host = "192.168.15.200:1535"; > > my $oracle_userid = "user"; > my $oracle_passwd = "passwd"; > ################ > > my $dsn = "Driver={Oracle in > instantclient_11_2};server=$oracle_host;sid=$oracle_sid"; > > my $dbh = DBI->connect("dbi:ODBC:$dsn", "$oracle_userid", > "$oracle_passwd"); > > It returns (after a few seconds) with an ORA-12154 error: TNS:could not > resolve the connect identifier specified ( SQL-08004). > > Thanks for any help... > > Scott... > > > > Scott...