zimbot has asked for the wisdom of the Perl Monks concerning the following question:

friends, I wish to connect to a mySql database on a Linux machine from a windows machine ( win2003 server ) but 1st i wish to connect from a win XP ( my devel sys ) actually my real goal is to get values from a db and use them with imagemagik to make a pdf ... but 1st I need to connect to the MySql server ... then i suppose i will attempt a query ... then I suppose i will attempt to use those values in imagemagik so- how to connect to the sever on my XP sytem i have installed DBI
my current perl #!C:\perl\bin\perl use warnings; use strict; use DBI; my $hostname = 'mysql.208.233.55.555:3306'; my $database = 'actaulDBNotGiven'; my $user = 'ActualNameNotGiven'; my $password = ''; my $driver = 'mysql'; my $dsn = "DBI:$driver:database=$database;host=$hostname"; my $dbh = DBI->connect($dsn, $user, $password) or die "Can't connect\n + $!\n"; print "$_\n" for $dbh->tables; $dbh->disconnect(); exit;
so i have obscured the server addrss is this 'form" right 'mysql.208.233.55.555:3306'; with the ip num being 208.233.55.555 ( yes - that's not the num ) and port 3306 and I do not have a password so I am thinking my $password = ''; would be OK
when I run the above ( with the real addrss etc ) i get install_driver(mysql) failed: Can't locate DBD/mysql.pm in @INC (@INC +contains: C:/Perl/lib C:/Perl/site/lib .) at (eval 4) line 3. Perhaps the DBD::mysql perl module hasn't been fully installed, or perhaps the capitalisation of 'mysql' isn't right. Available drivers: DBM, ExampleP, File, Gofer, Proxy, Sponge. at D:\uofM\lable\cnt01.pl line 12 wher cnt01.pl is my file. I know the proper addrss , and usr & psswd and something -- i just did , and may have done wrong is this to insta +ll DBI ppm > install DBI >and i guess that worked cause i see a >Successfully installed DBI version 1.602 in ActivePerl 5.8.8.816. > >and i see where i can > install DBD-mysql > >but since the mysql is on a server do i need the >install DBD-mysql ?
Thnaks much

Replies are listed 'Best First'.
Re: how to connect to a mySql database
by moritz (Cardinal) on Dec 02, 2008 at 22:13 UTC
    but since the mysql is on a server do i need the install DBD-mysql ?

    Yes. The DBD::mysql module is needed on any host that wants to connect to a mysql server through DBI.

Re: how to connect to a mySql database
by zentara (Cardinal) on Dec 03, 2008 at 17:58 UTC
    You seem to be confused about the server versus the client and the software needed. Your client( win32 computer) needs BOTH the DBI module AND the DBD::Mysql driver module. The linux server which runs the mysql server, needs no modules....all it needs is the mysql database server running, which is a C program.

    I'm not really a human, but I play one on earth Remember How Lucky You Are