Re: Insights into DBI->connect differences



Is: mp3i
listed in your: tnsnames.ora file?
From what I see, it really looks like an issue with your "mp3i" not being a known service.

Capacio, Paula J wrote:

Capacio, Paula J wrote:



Hello, I'm hoping someone can explain why one of these connect
statements work and the other doesn't. The script sets environment values as such: $ENV{ORACLE_HOME} = "/usr/oracle/product/8.1.7_64";
$ENV{ORACLE_SID} = $db_alias; #$db_alias passed to script via
$ARGV[1]
my $dbh;



Louis wrote:


Paula, print these two variables out before the entry into the logical
test - just to see what they are. Send this back in a reply. Make


this

the case where the "else" clause should execute, as an example.
print "$db_alias =? $ENV{ORACLE_SID}\n";


The code now looks like:
my $dbh;
if ($method =~ /2/) { #this works
$dbh = DBI->connect('', "scott/tiger", '', 'Oracle') or die "Connect failed: $DBI::errstr\n";
}else{ #this doesn't
printIt("Just prior to connect...");
printIt("$db_alias =? $ENV{ORACLE_SID}");
printIt("\$ENV{ORACLE_HOME} to: $ENV{ORACLE_HOME}\n");
$dbh = DBI->connect("dbi:Oracle:$db_alias",'scott','tiger')
or die "Connect failed: $DBI::errstr\n";
}
And the new output:
Just prior to connect...
mp3i =? mp3i
$ENV{ORACLE_HOME} to: /usr/oracle/product/8.1.7_64
DBI->connect(mp3i) failed: ORA-12154: TNS:could not resolve service name

(DBD ERROR: OCIServerAttach) at ./OraConn3.pl line 52
Connect failed: ORA-12154: TNS:could not resolve service name (DBD
ERROR: OCIServerAttach)



Does this imply that the first case does not use TNS service names? The DBI docs state: "There is no standard for the text following the driver name. Each driver is free to use whatever syntax it wants. The only requirement the DBI makes is that all the information is supplied





in a single string. You must consult the documentation for the drivers





you are using for a description of the syntax they require." The DBD::Oracle doc doesn't go into detail on the variations and what they





imply. Can anyone provide some insight?

The issue I'm really trying to address is that both connection
variations work on an HP/UX 11.00 server, perl version: 5.006001, DBI (version 1.20), DBD::Oracle (version 1.12); but on an HP/UX 11.11 server with the same perl and oracle libraries/versions only the first





variation works. I'm trying to determine why and suggest a


resolution.

BTW, I'm a lowly programmer (aka: hacker); I'm not the DBA or the server sysadmin and the DBA doesn't know perl.


Thanks in advance.
Paula





.



Relevant Pages

  • Re: Insights into DBI->connect differences
    ... statements work and the other doesn't. ... Paula, print these two variables out before the entry into the logical test - just to see what they are. ... DBD::Oracle doc doesn't go into detail on the variations and what they ... variations work on an HP/UX 11.00 server, perl version: ...
    (perl.dbi.users)
  • Re: DHCP Server service just STOPS on its own - PLEASE HELP!
    ... "Paula" wrote in message ... I ran the forestprep and domainprep successfully 4 days ago in preperation for a Windows 2003 Domain Controller to be added. ... Would this cause the DHCP Server serviceto just stop running? ...
    (microsoft.public.win2000.active_directory)
  • Re: Continue SP after Database Access Failure
    ... Paula ... > You can check PING Server to make sure that remote server is UP or DOWN ... >> Works for tables on the local SQL server, but not on Linked Servers, which ...
    (microsoft.public.sqlserver.programming)
  • RE: Trying to test 5.5 migration to 2003 in a LAB Environment - HELP!
    ... you can't restore Exchange 5.5 to an alternate server. ... "Paula" wrote: ... > directory service in a different domain and different server name to attempt ... I want to use actual data and do the real migration ...
    (microsoft.public.exchange.misc)