At 10:51 AM +0200 8/19/99, Philippe_PIERRE@stripped wrote:
>Hi,
>
>I'm really new in CGI programmation and in MySQL.
>Here are my configuration and my problem :
>
>I use Apache, Perl5 and MySQL for Win32.
>I installed DBI and the driver DBI:Mysql correctly.
>
>
>I have installed MySQL under
>-> C:\MySQL
>
>...and my database is in the directory :
>-> C:\MySQL\data\Mybase
>with the files :
>-> C:\MySQL\data\Mybase\MyTable1.frm
>-> C:\MySQL\data\Mybase\MyTable1.isd
>-> C:\MySQL\data\Mybase\MyTable1.ism
>-> C:\MySQL\data\Mybase\db.frm
>-> C:\MySQL\data\Mybase\db.isd
>-> C:\MySQL\data\Mybase\db.ism
>-> C:\MySQL\data\Mybase\host.frm
>-> C:\MySQL\data\Mybase\host.isd
>-> C:\MySQL\data\Mybase\host.ism
>-> C:\MySQL\data\Mybase\user.frm
>-> C:\MySQL\data\Mybase\user.isd
>-> C:\MySQL\data\Mybase\user.ism
>
>I success in create my base and the daemon Mysqld apparently work fine.
>
>
>In other hand, I write a simple PERL script, which work under Apache, at
>the location:
>-> C:\Apache\cgi-bin\Myscript.cgi
>... and the script start like this :
>
>
>sub Create_Connection{
> use DBI;
> $base = "c:\mysql\data\Mybase";
> $DSN = "DBI:mySQL:$base";
> $user = "root";
> $pw = "";
> print "TITI";
> $dbh = DBI->connect($DSN,$user,$pw) || die "Cannot connect:
>$DBI::errstr\n" unless $dbh;
> print "TOTO";
> return;
>}
Your script has a few problems:
- $base should be just the name of your database "Mybase", not the pathname
to it on the server host.
- $DSN should have "mysql", not "mySQL" (the capitalization matters)
- Your connect() call is a little odd. It has an extra conditional. I'd
write it like this:
$dbh = DBI->connect($DSN,$user,$pw)
die "Cannot connect: $DBI::errstr\n";
You don't need the extra "unless $dbh" part.
>TITI is printed on the screen but not TOTO, so i can't connect to my base !
>
>Actually, i don't understand how works the link beetween the MySQL base and
>the script. How does it connect to the base ?
Not sure what you mean here.
--
Paul DuBois, paul@stripped