I am having problems connecting to Oracle databases using Perl. I am able to connect to these databases using Benthic Golden32(third party software) and SQLPlus. Im using activestate perl 5.6, DBD-Oracle 1.16, DBI 1.48. I never had this problem before using the same scripts. I just got a new computer at work, dualcore Xeons and now I cant connect after re-installing everything.
Here is the error:
failed: ORA-12154: TNS:could not resolve the connect identifier specif
+ied (DBD ERROR: OCIServerAttach) on line 70.
Heres the code for my script:
line 70 is the line that starts with my $dbp = DBI->....
print "Setting Database Connection to CDW-P.....\n";
# setting up database connection to CDW-P
my $dbp = DBI->connect( 'dbi:Oracle:CDWP02' , "$user1" , "$passw")
|| die "Database connection not made: $DBI::errstr";
# Queries
$Total_Free = "select SUM(BYTES/(1024*1024*1024)) as FREE_GB\n".
"from dba_free_space WHERE TABLESPACE_NAME = 'USERSAUTO'";
$Total_V_Used = "select SUM(bytes/(1024*1024*1024)) as USE_GB\n".
"from dba_segments WHERE TABLESPACE_NAME = 'USERSAUTO'\n";
$Used_by_ID = "select owner, SUM(bytes/(1024*1024*1024)) as TOTAL_GB\n
+".
"from dba_segments WHERE TABLESPACE_NAME = 'USERSAUTO'\n".
"group by owner\n".
"order by TOTAL_GB desc";
# Run Used Space Query
print "Getting Used Space.\n";
### Prepare a SQL statement for execution
$CDWP_space_used = $dbp->prepare( "$Total_V_Used");
### Execute the statement in the database
$CDWP_space_used->execute;
while ( $row = $CDWP_space_used->fetchrow_array( ) ) {
$GC_space_used = $row;
}
print "$GC_space_used , Total CDW-P space\n";
Let me know if you need more information or the whole code for the script.
Thanks in advance to all u perl gurus....
2006-04-14 Retitled by planetscape, as per Monastery guidelines
Original title: 'DBD error Ora-12154'