can't connected to DB
------=_NextPart_000_00C3_01C7A2B6.2418EF70
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Hi,
I have simple script , trying to get connection to DB.
#!/usr/bin/perl
use DBI;
my $database=3D"billing";
my $data_source =3D "DBI:mysql:$database;host=3D165.21.101.47";
my $dbh =3D DBI->connect( $data_source,"root","G08hhABC", {RaiseError =
=3D> 1, PrintError =3D> 1,AutoCommit =3D> 1} ) or die "Unable to =
connect: " . $DBI::errstr . "\n";
I get this error from DB connection.
install_driver(mysql) failed: Can't load =
'/usr/lib64/perl5/site_perl/5.8.5/x86_64-linux-thread-multi/ auto/DBD/mysq=
l/mysql.so' for module DBD::mysql: libmysqlclient.so.15: cannot open =
shared object file: No such file or directory at =
/usr/lib64/perl5/5.8.5/x86_64-linux-thread-multi/DynaLoader. pm line 230.
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 ./m_Relay.pl line 38
Anyone can help me how to solve it. Thanks
Rgds
Keng Hee
------=_NextPart_000_00C3_01C7A2B6.2418EF70--
Re: can't connected to DB
On Wed, 30 May 2007, Keng Hee wrote:
> Hi,
>
> I have simple script , trying to get connection to DB.
....
> I get this error from DB connection.
> install_driver(mysql) failed: Can't load
> ....
> ...for module DBD::mysql: libmysqlclient.so.15: cannot open shared
Try ensuring that your underlying libmysqlclient.so is of the correct
version and that it is on your environment's library search path, before
invoking the script.
ie (for bash):
export LD_LIBRARY_PATH=/path/to/libmysqlclient.so:$LD_LIBRARY_PATH
This may need to be set in the environment the script is run in, or any
container environments - ie. apache.
If it's just a standalone, one-of script, you might try sticking it in a
begin block: BEGIN { $ENV{LD_LIBRARY_PATH}='path_to_lib' }
Just a thought. Hope it helps.
Cheers,
Raf
Re: can't connected to DB
Hi Keng,
On Wed, 30 May 2007, Raf wrote:
> On Wed, 30 May 2007, Keng Hee wrote:
> and that it is on your environment's library search path, before invoking the
> script.
>
> ie (for bash):
> export LD_LIBRARY_PATH=/path/to/libmysqlclient.so:$LD_LIBRARY_PATH
I clearly meant:
export LD_LIBRARY_PATH=/path/to/libdir:$LD_LIBRARY_PATH
That is, the directory where the mysql client libraries reside.
Cheers,
Raf