Name
connect
Synopsis
$db_handle= DBI->connect(data_source, user, passwd,[\%attr])
Connects to the specified database, returning a
database handle object. The connect method automatically installs
the driver if it has not already been installed.
data_sourceA string identifying the driver to connect to, and any other additional driver-specific information needed to identify the driver (e.g., a port number). The driver name is written in the form
dbi:driver_name, e.g.,dbi:mysql. (Default value is taken from the DBI_DSN environment variable.) For example, a connection string for the MySQL driver always starts withdbi:mysql:. The second colon should be followed by any information required by the driver to make the database connection. In the case of MySQL, you must supply a database name (bookdbin the following example), a hostname (localhost), and the port number of the database server (1114):DBI:$driver:database=$database;host=$hostname;port= $port
userThe username for the database connection. (Default value is taken from the DBI_USER environment variable.)
passwdThe password for the database connection. (Default value is taken from the DBI_PASS environment variable. Set this value at your own risk.)
\%attrA hash reference defining attributes for the database handle.