Sponsored Content
Top Forums Shell Programming and Scripting problem trying to access a database Post 302204598 by chriss_58 on Thursday 12th of June 2008 05:23:12 AM
Old 06-12-2008
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:OracleSmiliercl";
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 06:44 AM..
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

microsoft access database on Unix

Hello, I am a newborn baby to Unix and I was told that it was possible to have Microsoft Access databases on a Unix web server. I am using Perl to interface and query the Access database, which puts the information into the appropriate fields of a web page. Then updated information is submitted... (1 Reply)
Discussion started by: spiderling
1 Replies

2. Programming

C program with Oracle database access

Hey, I want to access oracle database through Unix C programming.. Can you through me some light on that... (5 Replies)
Discussion started by: kavi
5 Replies

3. Shell Programming and Scripting

Perl Database access

Hi, I tried to run this code but it isnt giving me any output or errors. My aim is to retrieve the row based on the flag name(this is the primary key). flag_test is my table This is how i ran it: perl read_db.pl flag1 flag1 is the criteria in where clause -------- this is my... (2 Replies)
Discussion started by: mercuryshipzz
2 Replies

4. UNIX for Advanced & Expert Users

Help with ms access database and firebird

Hi! I need to access two diferent databases allocated in a linux server through PHP. I know in the php.ini file I can't configure some parameters as odbc.default_db... but I can't configure it. I've already installed unixodbc drivers Can Anybody point me to a tutorial web o teach me how... (0 Replies)
Discussion started by: ncatdesigner
0 Replies

5. Shell Programming and Scripting

Access to database/eval command

Hi i have the following code: if(($line!=1) and (@field!='\$')){ print ( "\nTRY TO CONNECT TO DATABASE................\n"); my $dbh = DBI->connect($dsn, $user, $pass); print ("CONNECTED TO DATABASE\n"); eval ... (1 Reply)
Discussion started by: chriss_58
1 Replies

6. Shell Programming and Scripting

Database access

Hell all, I have the following snippet of code: $sql=qq{select * from ( select to_char(t.start_time_timestamp,'yyyy/mm/dd hh24:mi:ss') start_time,t.s_p_number_address, null cos_icsa_code, null cos_icsa_subcode from cc_unrated_msc_flow t union select... (2 Replies)
Discussion started by: chriss_58
2 Replies

7. IP Networking

Access database over internet, help

Hi! :D I'm new here, and I will appreciate all the help you can give. This is the problem we are trying to solve at my office. At office 1 we have SCO UNIX 5.0.can't remember last number. On it runs database software on which we input/read/modify data throughout terminal software, on remote... (1 Reply)
Discussion started by: PNemesis
1 Replies

8. Shell Programming and Scripting

using unix scripts database access

i want to access database (sql script) within a unix script. help me (2 Replies)
Discussion started by: chamaraa
2 Replies

9. UNIX for Dummies Questions & Answers

Access to a database

Hello all, is it possible to write a script in order to connect to a database, load data in a specific domain and execute the corresponding command? (3 Replies)
Discussion started by: FelipeAd
3 Replies

10. AIX

No Suitable Driver for MS Access database

Hi, I am running a JDBC:ODBC code to access .mdb file in my windows system successfully but, not able to access MS Access mdb file in AIX Unix box. when I am trying to run the same piece of code in AIX Unix box it is saying "No Suitable Driver". I need some immediate help. (0 Replies)
Discussion started by: thirunp
0 Replies
FirebirdEmbedded(3pm)					User Contributed Perl Documentation				     FirebirdEmbedded(3pm)

NAME
DBD::FirebirdEmbedded - embedded Firebird server (and client) SYNOPSIS
use DBI; $dbh = DBI->connect("dbi:FirebirdEmbedded:db=$dbname", undef, undef); # See the DBI module documentation for full details DESCRIPTION
DBD::FirebirdEmbedded is a variant of DBD::FirebirdEmbedded, linked with the Firebird embedded library, libfbembed. In addition to the ability to work with remote Firebird servers (which DBD::FirebirdEmbedded has, being linked with the Firebird client library, libfbclient), DBD::FirebirdEmbedded can be used to work with Firebird databases without the need of a dedicated Firebird server. The following things should be set up first: Username/password These should be unset. Both in the "DBI->connection(...)" call and in the environment ("ISC_USER", "ISC_PASSWORD", "DBI_USER", "DBI_PASSWORD" variables). Firebird lock directory The "FIREBIRD_LOCK" environment variable should be set to some place where the process can write. Note that if you plan for several processes to access the database file directly, they all should have "FIREBIRD_LOCK" set to the same directory, or else database corruption will occur. No "host" in the DSN Obviously, do not set any host when calling "DBI->connection(...)", not even "localhost". Permissions to read/write the database Obviously, the process needs to be able to read/write the database file. COMPARISON WITH DBD
::FIREBIRD DBD::FirebirdEmbedded provides exactly the same functionality as the Firebird server of the same version as the libfbembed library. It still can work with remote datases, in which case the use is exactly the same (DSN, environment) as with the regular DBD::FirebirdEmbedded. Pros Standalone work with Firebird databases No need to setup/administer a Firebird server. All the server functionality is available via the libfbembed library. Shared access to databases is still possible (but read "Firebird lock directory" above). No network latency Working directly with the database file elliminates possible network delays (even if the server is on the local host). Cons Memory footprint The libfbembed library contains a fully functional Firebird server and is therefore bigger than the ordinary client library, libfbclient. Setup complexity It is very important to make sure that all processes that access a given database use the same lock directory. See "Firebird lock directory" above. SEE ALSO
DBD::FirebirdEmbedded perl v5.14.2 2011-11-15 FirebirdEmbedded(3pm)
All times are GMT -4. The time now is 09:43 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy