J
Jack
Hi folks,
On windows server 2003 I installed the Mysql ODBC driver, created a
dsn, and installed DBI and DBD::ODBC perl modules. Does anyone have
experience issuing a SQL query through PERL to Mysql.. here is my
program, the uncommented pieces worked great but when I remove the
comments for the bottom 2 rows I get the error indicated:
use DBD::ODBC;
use strict;
use diagnostics;
use DBI;
eval {
my $dbh = DBI->connect('DBI:ODBC:mysqldsn;host=localhost;', 'root',
's1ghtspr1ng7281',
{ 'RaiseError' => 1, 'PrintError' => 0, 'AutoCommit' => 0} );
}; # eval
# $sth = $dbh->prepare("SELECT testcol1 FROM temptable");
# $sth->execute( $baz );
ERROR:
E:\tmp>perl odbc_test2.pl
Global symbol "$sth" requires explicit package name at odbc_test2.pl
line 14.
Global symbol "$dbh" requires explicit package name at odbc_test2.pl
line 14.
Global symbol "$sth" requires explicit package name at odbc_test2.pl
line 15.
Global symbol "$baz" requires explicit package name at odbc_test2.pl
line 15.
Execution of odbc_test2.pl aborted due to compilation errors (#1)
(F) You've said "use strict vars", which indicates that all
variables
must either be lexically scoped (using "my"), declared beforehand
using
"our", or explicitly qualified to say which package the global
variable
is in (using "::").
Uncaught exception from user code:
Global symbol "$sth" requires explicit package name at
odbc_test2.pl lin
e 14.
Global symbol "$dbh" requires explicit package name at odbc_test2.pl
line 14.
Global symbol "$sth" requires explicit package name at odbc_test2.pl
line 15.
Global symbol "$baz" requires explicit package name at odbc_test2.pl
line 15.
Execution of odbc_test2.pl aborted due to compilation errors.
at odbc_test2.pl line 16
On windows server 2003 I installed the Mysql ODBC driver, created a
dsn, and installed DBI and DBD::ODBC perl modules. Does anyone have
experience issuing a SQL query through PERL to Mysql.. here is my
program, the uncommented pieces worked great but when I remove the
comments for the bottom 2 rows I get the error indicated:
use DBD::ODBC;
use strict;
use diagnostics;
use DBI;
eval {
my $dbh = DBI->connect('DBI:ODBC:mysqldsn;host=localhost;', 'root',
's1ghtspr1ng7281',
{ 'RaiseError' => 1, 'PrintError' => 0, 'AutoCommit' => 0} );
}; # eval
# $sth = $dbh->prepare("SELECT testcol1 FROM temptable");
# $sth->execute( $baz );
ERROR:
E:\tmp>perl odbc_test2.pl
Global symbol "$sth" requires explicit package name at odbc_test2.pl
line 14.
Global symbol "$dbh" requires explicit package name at odbc_test2.pl
line 14.
Global symbol "$sth" requires explicit package name at odbc_test2.pl
line 15.
Global symbol "$baz" requires explicit package name at odbc_test2.pl
line 15.
Execution of odbc_test2.pl aborted due to compilation errors (#1)
(F) You've said "use strict vars", which indicates that all
variables
must either be lexically scoped (using "my"), declared beforehand
using
"our", or explicitly qualified to say which package the global
variable
is in (using "::").
Uncaught exception from user code:
Global symbol "$sth" requires explicit package name at
odbc_test2.pl lin
e 14.
Global symbol "$dbh" requires explicit package name at odbc_test2.pl
line 14.
Global symbol "$sth" requires explicit package name at odbc_test2.pl
line 15.
Global symbol "$baz" requires explicit package name at odbc_test2.pl
line 15.
Execution of odbc_test2.pl aborted due to compilation errors.
at odbc_test2.pl line 16