Talking with the Database : DBI « Database « Perl






Talking with the Database

   

#!\usr\bin\perl

use warnings;
use strict;
use DBI;
my $dbh=DBI->connect('dbi:mysql:test','root','password') || die "Error opening database: $DBI::errstr\n";
print "Hello\n";
$dbh->disconnect || die "Failed to disconnect\n";
print "Goodbye\n";

   
    
    
  








Related examples in the same category

1.Listing Currently Installed Drivers
2.Listing Valid DSNs
3.The connect() Method
4.Use DBI to connect to a database
5.Connect to Oracle
6.Connect to mysql
7.Binding Columns
8.Available DBI Drivers and Data Sources