Hi all,
I am trying to access an Informix database, that I have only connect
permissions,
and I am trying to 'eval' the code below, but for some reason that I can't
identify,
no error occurred in the first 2 select statements, the error occurred at
third
SQL statement, which is drop table. When running any of the first 2 select
statments manually, I got
an error that I don't have permissions.
What I am expecting is to exit the eval block from the first SQL statement
since I don't have
permissions.
I can't identify the problem, is it from the DBI or DBD::Informix, that not
catching the error.
Regards,
Mahdi.
#########################################################
my ($run_tab_count);
my ($sql_stmt_drop_run_cnt);
my ($tab_type) = 'T';
my ($tab_name_like) = 'run%';
my (@tab_names_array) = ();
my ($run_tab_name);
### Starting the eval Block
eval {
### Quote String Variables
my($quoted_tab_type) =
$db_handle->quote($tab_type);
my($quoted_tab_name_like) =
$db_handle->quote($tab_name_like);
$run_tab_count =
$db_handle->selectrow_array("
select count(*)
from systables
where tabname like $quoted_tab_name_like
AND tabtype = $quoted_tab_type
");
if ($run_tab_count == 0)
{
print("\nNo RUN Tables Found In The
Database.\n\n");
return;
}
$sql_stmt_drop_run_cnt =
$db_handle->prepare("
select tabname
from systables
where tabname like $quoted_tab_name_like
AND tabtype = $quoted_tab_type
");
$sql_stmt_drop_run_cnt->execute();
while ( $run_tab_name =
$sql_stmt_drop_run_cnt->fetchrow_array )
{
# dropping RUN... tables one at a
time
print("\nDropping table
$run_tab_name...\t");
$db_handle->do("
drop table
$run_tab_name
");
print("dropped.");
}
print("\n\nRUN tables dropped successfully....\n");
}; # End eval Block...
if ($@)
{
++$no_of_errors;
print LOGFILE "E:\t";
error_log();
### Disconnect and Exit
connection_function(2);
}
##########################################################
-----Original Message-----
From: pkp team [mailto:[EMAIL PROTECTED]]
Sent: Monday, July 02, 2001 12:02 PM
To: [EMAIL PROTECTED]
Subject: DBI error
Hello all:
I have a problem. I have a small script:
"#!/usr/bin/perl -w
use DBI;
use strict;
my $db = 'test';
my $host = 'localhost';
my $id = 'root';
my $pwd= 'passwd';
my $dbh = DBI->connect("DBI:mysql:$db:$host",$id,$pwd);
if(!defined $dbh) {
die "Can't connect: $DBI::errstr \n";
}
print "Connected!!\n";
exit;"
However, i am getting the following error on running the script:
"/usr/bin/perl: error while loading shared libraries:
/usr/lib/perl5/site_perl/5.6.0/i386-linux/auto/DBD/mysql/mysql.so: undefined
symbol: mysql_init"
I think i should mention here that i had some problems installing DBD::mysql
(it gave me errors everytime i ran make test).
I mentioned it here on the mailing list, and some people suggested that i
can ignore it.
But now i cant even run a simple script.
Any help would be greatly appreciated. I have been stuck on getting
DBI/DBD/Mysql running for more than a week now!
Thanking inadvance,
Trev
_________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.