Summary
Connect to a Database with DBI/DBD
- Make the connection. Receive a database handle.
$dbh = DBI->connect("DBI:mysql:test_nile", "memyself", "");
- Deliver some SQL. Receive a statement handle.
$sth = $dbh->prepare( "SQL STATEMENT" );
- Do the SQL.
$sth->execute;
- Free up the resources used by the SQL.
$sth->finish;
- Continue to prepare, execute, and finish statements until done.
- Disconnect from the database.
$dbh->disconnect;
Dan Keller Technical Services © 2000