in reply to DBI->connect using 'old-style' syntax is deprecated and will be an error in future versions

Hi LameNerd.

The syntax you tried to use has changed. I took the liberty of including a small, simple, (and tested) code sample ( ActiveState 5.8.0, DBI version 1.37, MySQL 4.0.1).

#!/usr/bin/perl -w use strict; use DBI; my $DSN = "DBI:mysql:database=testDB"; my $dbh = DBI->connect( $DSN, "xxx", "xxx" ) or die "$DBI::errstr"; my $sth = $dbh->prepare("select * from teams"); $sth->execute(); while( my $ref = $sth->fetchrow_hashref() ) { print "$ref->{'wins'} $ref->{'losses'}"; } $sth->finish(); $dbh->disconnect();


In case you're interested, here are some resources:

Title:Programming the Perl DBI
ISBN:1565926994
List Price:$34.95

Title:Mysql and Perl for the Web
ISBN:0735710546
List Price:$44.99

Title:MySQL, Second Edition
ISBN:0735712123
List Price:$49.99

http://www.perl.com/lpt/a/1999/10/DBI.html
http://www.devshed.com/Server_Side/Perl/Carping/print_html
http://www.eskimo.com/~ericj/personal/postgresql/sql1.htm
http://www.eskimo.com/~ericj/personal/postgresql/sql2.htm
http://www.eskimo.com/~ericj/personal/postgresql/sql3.htm

Hope these help,

If you have any more questions, don't hesitate to ask.

Thanks,
-Katie
  • Comment on Re: DBI->connect using 'old-style' syntax is deprecated and will be an error in future versions
  • Download Code