Here's part of a tutorial that I'm putting together on the subject:
* Verify the DBI/DBD installation *
Here we will run a script that will connect to the database "test"
(which is created during the MySQL install) and perform a simple SQL
query using the Perl DBI.
a) Write this script and save it as "dbi_connect.pl"
# A test script for connecting to a database using the Perl DBI
use DBI; # Loads the DBI module
my $driver = "mysql";
my $database = "test";
my $hostname = "localhost";
my $username = "<username>";
my $password = "<password>";
my $dsn = "dbi:$driver: database=$database , host=$hostname";
my $dbh = DBI->connect($dsn , $username , $password)
or die "Can't connect to MySQL database: $DBI::errstr\n";
# issue query
$sth = $dbh->prepare
# read results of query, then clean up
$when = $sth->fetchrow_array ();
$dbh->disconnect or warn "Disconnection failed: $DBI::errstr\n";
b) Edit it by specifying your MySQL username and password
c) Make it executable and run it.
If you get the current date and time then you're all set!
- Pumpkinhead -
On Sun, 31 Dec 2000 15:29:39 +0000, =?ISO-8859-1?Q?M=E1rio?= Gamito
>I've installed apache with mod_perl which i'm preety shure is working fine,
>because i use phpinfo() function to test apache's configuration.
>At a friend of mine's advice, I've also installed modules DBD and DBI for
>MySQL (he claims that it makes life much easier while programming with DBs)
>How can i verify if these two modules are peroperly installed?
>They are not being reported by phpinfo()
>Thanks in advance.
>pt is for Portugal