preface 
 
  Look_up Engine  
 
  email how to  
 
  counter  
 
  regex  
 
  search engine  
 
  home  
 
  ask us  
 

 

Perl scripting


Applications


OO Perl


Perl & Databases


Search a word:
   



© The scientific sentence. 2010

Connecting to databases

Connection to MySQL

Once MySQL database is installed, and at least one database is created (example "academia") with some tables, we can perform the following to make connection: To get connected with MySQL database "academia", we use the following code: #!C:/Perl/bin/perl use DBI; use strict; my $driver = "mysql"; my $database = "academia"; my $dsn = "DBI:$driver:database=$database"; my $userid = "root"; my $password = "The_password"; my $dbh = DBI->connect($dsn, $userid, $password ) or die $DBI::errstr; $dsn: Database source name $dbh : Database handle object Once the connection is established, the "Database Handle" is returned and saved into $dbh. Otherwise, $DBI::errstr will return an error string.
  
Google
Web
ScientificSentence
 




chimie labs
|
scientific sentence
|
java
|
php
|
green cat
|
contact
|


© Scientificsentence 2007. All rights reserved.