DBD-mysql - Error using DBI and DBD-mysql

Posted on Wed Sep 5 06:31:01 2007 by libsys
Error using DBI and DBD-mysql
I'm having a problem using the DBI module to connect to a mysql database. I installed DBI 1.59 followed by DBD-mysql 4.005 and everything seemed to go smoothly *except* that when I ran 'make test' during the DBD-mysql install pretty much all of the tests failed with an error similar to the following:

t/utf8...............install_driver(mysql) failed: Can't load '/home/knightsg/DBD-mysql-4.005/blib/ +arch/auto/DBD/mysql/mysql.so' for module DBD::mysql: /home/knightsg/DBD-mysql-4.005/blib/arch/auto +/DBD/mysql/mysql.so: undefined symbol: mysql_stmt_sqlstate at /usr/lib/perl/5.8/DynaLoader.pm line + 225. at (eval 3) line 3 Compilation failed in require at (eval 3) line 3. Perhaps a required shared library or dll isn't installed where expected at t/utf8.t line 49


Apart from that, building DBD-mysql worked fine and installed without incident. However, when I run my script I get the following error output:

/usr/bin/perl: symbol lookup error: /usr/local/lib/perl/5.8.8/auto/DBD/mysql/mysql.so: undefined sy +mbol: mysql_server_init


The mysql code in my script is as follows (I've only included the lines relevant to the mysql connection):

use DBI; # MySQL connection settings $host = 'jasper.lib.tils.qut.edu.au'; $database = 'QUT_EPrints'; $tablename = 'document'; $username = 'XXXXXXXX'; $password = 'XXXXXXXX'; $dsn = "DBI:mysql:database=$database;host=$host;port=3306"; $dbh = DBI->connect($dsn, $username, $password) or die("Could not connect");


I've trawled through google looking for any way to resolve this and so far I've come up with nothing that helps. None of the pages I found on google that relate to this issue have provided a solution to the problem. The configuration line I used to build DBD-mysql has the correct location of the libmysqlclient libraries (I've checked a number of times), but it still doesn't seem to be able to find or use the library when running the 'make test'.

I've upgraded perl and gcc to the latest versions (5.8.8 and 4.1.2 respectively) but this has changed nothing.

I'm really at a loss here, so any help would be greatly appreciated.
Direct Responses: 6321 | Write a response