------_=_NextPart_001_01CA4922.14D7F391
Content-Type: text/plain;
charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
Problem getting Perl to connect to mysql database. Here is all of the
information:
$ perl -v
This is perl, v5.8.4 built for sun4-solaris-64int
(with 29 registered patches, see perl -V for more detail)
Copyright 1987-2004, Larry Wall
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.
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
use DBI;
print <<END;
Content-type: text/html
<html>
<head>
<title>Example of Perl calling MySQL</title>
</head>
<body bgcolor=3D"white">
END
# 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";
# 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";
# prepare and execute query
$query =3D "SELECT userid, user_name FROM ad_user";
$sth =3D $dbh->prepare($query);
$sth->execute();
# assign fields to variables
$sth->bind_columns(\$userid, \$user_name);
# output name list to the browser
print "Names in the people database:<p>\n";
print "<table>\n";$ ./mysql_print.pl
Content-type: text/html
while($sth->fetch()) {
print "<tr><td>$userid<td>$user_name\n";
}
print "</table>\n";
print "</body>\n";
print "</html>\n";
$sth->finish();
# disconnect from database
$dbh->disconnect;
Error receiving:
$ ./mysql_print.pl
Content-type: text/html
<html>
<head>
<title>Example of Perl calling MySQL</title>
</head>
<body bgcolor=3D"white">
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
<html>
<head>
<title>Example of Perl calling MySQL</title>
</head>
<body bgcolor=3D"white">
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.
------_=_NextPart_001_01CA4922.14D7F391--
