Perl: Establishing a Connection
Establishing a Connection
$dbh->connect('DBI:mysql:test:localhost:3306','eric', 'password')
or die “connectiong: $DBI::errstr\n”;
This connects to database “test” on the local machine as user eric:
The database URL contains the DBI driver name, database name, hostname and port number:
DBI:mysql:test:localhost:3306