Unix/Linux Go Back    


Shell Programming and Scripting Unix shell scripting - KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and shell scripts and shell scripting languages here.

problem trying to access a database

Shell Programming and Scripting


Closed Linux or Unix Question    
 
Thread Tools Search this Thread Display Modes
    #1  
Old Unix and Linux 06-12-2008
chriss_58 chriss_58 is offline
Registered User
 
Join Date: May 2008
Last Activity: 9 March 2015, 9:23 AM EDT
Posts: 58
Thanks: 1
Thanked 0 Times in 0 Posts
problem trying to access a database

hi guys,

I am using the following code in order to access a database.

#!/usr/bin/perl

print "READ DATA FROM DATABASE\n";

use DBI;
use strict;
#use DBD::Oracle;


my $user='reassure';
my $pass='R3Assur3';
#my $dsn="dbi:OracleLinuxrcl";
my $dsn='dbi:Oracle:cobscs.world';
my $dbh = '';
my $sth='';
my @row= '';
my $answa='';
my $answt='';
my $name="ddd03ed";
my $sql="";
my $sth="";
my $dbh="";

#$ENV{ORACLE_HOME} = "/home/oracle/product/9.2.0.1.0"

eval
{

print "connect to database";
$dbh = DBI->connect($dsn, $user, $pass);
print "connected to database\n";
$sql = qq{ SELECT * FROM rtx_test };
#my $sql = "SELECT name from christos1";
#my $sql = qq{ SELECT * FROM cc_test_cases};
print("HELLO\n");

$sth = $dbh->prepare( $sql );
$sth->execute( );
};

if ($@) {
print "An error occurred ($@), continuing\n";

}


#$sth = $dbh->prepare($sql);^M
#$sth->execute($answa, $answt);^M
print("HELLO1\n");
while(@row = $sth->fetchrow_array()) { ^M
print "$row[0]: $row[1]\n"; ^M
}

print("HELLO2\n");


#while ( my(@helloWorldString) = $sth->fetchrow_array) {

#print @helloWorldString, "\n";
#}

$dbh->disconnect( ); # Disconnect
#};


when i am trying to run the script i get the following error.
connect to databaseAn error occurred (install_driver(Oracle) failed: Can't locate DBD/Oracle.pm in @INC (@INC contains: /opt/perl_32/lib/5.8.8/IA64.ARCHREV_0-thread-multi /opt/perl_32/lib/5.8.8 /opt/perl_32/lib/site_perl/5.8.8/IA64.ARCHREV_0-thread-multi /opt/perl_32/lib/site_perl/5.8.8 /opt/perl_32/lib/site_perl /opt/perl_32/lib/vendor_perl/5.8.8/IA64.ARCHREV_0-thread-multi /opt/perl_32/lib/vendor_perl/5.8.8 /opt/perl_32/lib/vendor_perl .) at (eval 4) line 3.
Perhaps the DBD::Oracle perl module hasn't been fully installed,
or perhaps the capitalisation of 'Oracle' isn't right.
Available drivers: DBM, ExampleP, File, Proxy, Sponge.



One more thing.
I can find this Oracle.pm under the following directory

/oracle/product/10.2.0.2/perl/lib/site_perl/5.8.3/IA64.ARCHREV_0-thread-multi-LP64/DBD/Oracle.pm




Any idea why this happens??

Thank you

Last edited by chriss_58; 06-12-2008 at 05:44 AM..
Sponsored Links
    #2  
Old Unix and Linux 06-12-2008
chriss_58 chriss_58 is offline
Registered User
 
Join Date: May 2008
Last Activity: 9 March 2015, 9:23 AM EDT
Posts: 58
Thanks: 1
Thanked 0 Times in 0 Posts
One more thing.
I can find this Oracle.pm under the following directory

/oracle/product/10.2.0.2/perl/lib/site_perl/5.8.3/IA64.ARCHREV_0-thread-multi-LP64/DBD/Oracle.pm
Sponsored Links
Closed Linux or Unix Question

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Linux More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Access to a database FelipeAd UNIX for Dummies Questions & Answers 3 04-20-2011 05:14 AM
Access database over internet, help PNemesis IP Networking 1 12-01-2009 02:22 PM
Database access chriss_58 Shell Programming and Scripting 2 10-14-2008 10:53 AM
Help with ms access database and firebird ncatdesigner UNIX for Advanced & Expert Users 0 05-14-2008 10:05 AM
Perl Database access mercuryshipzz Shell Programming and Scripting 2 01-16-2008 12:54 AM



All times are GMT -4. The time now is 03:11 PM.