The connect() Method : DBI « Database « Perl






The connect() Method

   

$dbh= DBI->connect("dbi:<RDMS>:<database>","<username>","<password>",\%attributes) or die("Couldn't connect");

$dbh=DBI->connect('DBI:mysql:sample_db','root','quigley1') or die "Can't connect";

$dbh=DBI->connect('DBI:mysql:database=sample_db;user=root;password=quigley1');

   
    
    
  








Related examples in the same category

1.Listing Currently Installed Drivers
2.Listing Valid DSNs
3.Talking with the Database
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