FW: Mysql Perl Issue

FW: Mysql Perl Issue

am 09.10.2009 22:54:26 von Doug Pisarek

=20

-----Original Message-----
From: Doug Pisarek [mailto:dgp@strata-group.com]=20
Sent: Friday, October 09, 2009 3:50 PM
To: perl@lists.mysql.com
Subject: Mysql Perl Issue

Problem getting Perl to connect to mysql database. Here is all of the
information:
=20
$ perl -v
=20
This is perl, v5.8.4 built for sun4-solaris-64int (with 29 registered
patches, see perl -V for more detail)
=20
Copyright 1987-2004, Larry Wall
=20
Perl may be copied only under the terms of either the Artistic License
or the GNU General Public License, which may be found in the Perl 5
source kit.
=20
Complete documentation for Perl, including FAQ lists, should be found on
this system using `man perl' or `perldoc perl'. If you have access to
the Internet, point your browser at http://www.perl.com/, the Perl Home
Page.
mysql Ver 14.12 Distrib 5.0.51a, for sun-solaris2.10 (sparc) using
readline 5.0
------------------------------------------------------------ ------------
---------------------------------------------------
$ mysql -V
mysql Ver 14.12 Distrib 5.0.51a, for sun-solaris2.10 (sparc) using
readline 5.0
------------------------------------------------------------ ------------
----------------------------
Code running:
#!/usr/bin/perl
=20
use DBI;
=20
print < Content-type: text/html
=20


Example of Perl calling MySQL
=20

=20
END
=20
# database information
print"DB connect\n";
$db=3D"c3c_v8_24_dev";
$host=3D"db110g";
$userid=3D"root";
$passwd=3D"strata";
$connectionInfo=3D"dbi:mysql:$db;$host";
=20
# make connection to database
print"Make connection \n";
$dbh =3D DBI->connect($connectionInfo,$userid,$passwd) ||
die "Got error $DBI::errstr when connecting to $dsn\n";
=20
# prepare and execute query
$query =3D "SELECT userid, user_name FROM ad_user"; $sth =3D
$dbh->prepare($query); $sth->execute();
=20
# assign fields to variables
$sth->bind_columns(\$userid, \$user_name);
=20
# output name list to the browser
print "Names in the people database:

\n"; print "

\n";$
../mysql_print.pl
Content-type: text/html
=20
while($sth->fetch()) {
print "
$userid$user_name\n";
}
print "
\n";
print "\n";
print "\n";=20
=20
$sth->finish();
=20
# disconnect from database
$dbh->disconnect;

Error receiving:
=20
$ ./mysql_print.pl
Content-type: text/html
=20


Example of Perl calling MySQL
=20

=20
DB connect
Make connection
ld.so.1: perl: fatal: relocation error: file
/usr/perl5/site_perl/5.8.4/sun4-solaris-64int/auto/DBD/mysql /mysql.so:
symbol mysql_init: referenced symbol not found Killed

=20


Example of Perl calling MySQL
=20

=20
DB connect
Make connection
ld.so.1: perl: fatal: relocation error: file
/usr/perl5/site_perl/5.8.4/sun4-solaris-64int/auto/DBD/mysql /mysql.so:
symbol mysql_init: referenced symbol not found Killed


Thanks,
Doug P.
=20
=20

--
MySQL Perl Mailing List
For list archives: http://lists.mysql.com/perl
To unsubscribe: http://lists.mysql.com/perl?unsub=3Dgcdmp-msql-mysql-modules @m.gmane.org