I run Apache and Apache Tomcat servers on a Win2k laptop with PERL DBI
module used for communicating with MySQl, Oracle and Sybase successfully.
(Play coding).  Here is a test program I used for initial checkout of MySql.
Pay attention to what port your Apache is running, the port for Mysql. That
tripped me up at first.  Don't see any difference with Win98.  Use PPM to
load DBI (and lots of other goodies) easily as type 'install package'.  

...........................................
#!c:\perl\bin\perl -w
#
#------------------------------------------------------------
# iconf.cgi
# Created on 1/01/2002
# By Clay Stewart, SBi and Company
#------------------------------------------------------------
# Purpose:   Prototype Only
#
# Test for MySql DBI connect
#------------------------------------------------------------
# Required Code and Subroutine Libraries
#-------------------------------------------------------------
use DBI;
#use strict;
#
#------------------------------------------------------------
# MAIN
# Main routine for module
#-----------------------------------------------------------
MAIN:

{
$dbh = '';
$sth = '';
&D0000TraceOn;
&D0100Connect;
&D0105SelectTest
&D0800Finish;
&D0805Disconnect;
&D0005TraceOff;

print "test completed<br>";
}
#
#------------------------------------------------------------
# D0000
# Turn on Trace for DBI.
#
sub D0000TraceOn {

DBI->trace(2, 'c:\trace.txt');
}
#------------------------------------------------------------
# D0005
# Turn off Trace for DBI.
#
sub D0005TraceOff {

$dbh->trace(0); 
}
#------------------------------------------------------------
# D0100
# Connects to database using DBI calls.
#
sub D0100Connect {
  my $serverName = "localhost";
  my $serverPort = "3306";
  my $userid = "xxxxxxx";
  my $password = "xxxxxxxx";
  my $database = "cct";
  my $tableobjects = "cctobjects";
  my $dataSource = "DBI:mysql:$database:$serverName:$serverPort"; 
  $dbh = DBI->connect( $dataSource, $userid, $password);
  print "you are connected to $dataSource<br>";
}
}
#------------------------------------------------------------
# D0100
# Connects to database using DBI calls.
#
sub D0105SelectTest {
  $sth = $dbh->prepare("SELECT * FROM cctObjects");
  $sth->execute; 
  $row = $sth->fetchrow_arrayref;
  my($f,$l) = @$row; 
  print "$f  $l <br>";
}
#
#------------------------------------------------------------
# D0800
# Close handle sth
#
sub D0800Finish {
  $sth->finish;
}
#
#------------------------------------------------------------
# D0805
# Disconnect from Database
#
sub D0805Disconnect {
  $dbh->disconnect;  
}
...........................................

Clay Stewart, 26 years of punching code and still counting . . .

SBi and Company
supporting WorldCom Corporation


-----Original Message-----
From: Brian Canning [mailto:[EMAIL PROTECTED]]
Sent: Thursday, January 31, 2002 9:05 AM
To: DBI Users
Subject: Win98/ Mysql/ Perl DBI


Hi All
new to this list, can anybody tell me if this can be done

I have a Apache running on a Win98 system. I also
have active perl running, I would like to run MySQL on
it can this be done.
If so how do I install the DBI module to Active Perl?
If I install MySQL how do I tell perl where is it?
so the following line would work.

$dbh = DBI->connect("DBI:mysql:database=$dbname", "$dbuser",
"$dbpassword",{RaiseError => 1});
$sth = $dbh->prepare("SELECT * FROM djdmain WHERE id = ?");
$sth->execute($ID) ;
$matches =$sth->rows();

any help or URL to how to set this up would be great.
thanks

Brian

Reply via email to