Chapter 15 . Perl Development 403 and statements are run, and the connections are destroyed. Whenever you create an object, the DBI identifies it as a driver, a database, or a statement by associating it with one of three logical markers (known as handles) that correspond to those three types of objects: (drivers, databases, or statements). The handles are actually pointers to specific instances of objects. From a programming standpoint, you declare that you d like to use the DBI in your program by adding the following line near the beginning of your program: use DBI; Driver handles DBI driver handles are available for many database types. For the purposes of this book, you need be concerned only with the MySQL driver handle. Tip You can use more than one driver handle within the same program to connect to different database types. You can only use one driver handle per database. (Then again, why would you need more than one handle to the same driver?) You initialize the driver handle (or more properly, the DBI does so) behind the scenes. For example, the driver handle for MySQL is created when you call the connect method for the DBI. Database handles Database handles are the controls you use to manipulate database-related programs. When a database handle is created, you connect to the MySQL database and provide credentials such as username, password, and database name. These credentials are the same as those you would supply to connect with the MySQL CLI (or the mysqladmin command and so forth). The standard naming scheme for a database handle is the $dbh variable (which I use throughout this chapter). A database handle is created automatically whenever you call the connect method; the syntax looks like this: $dbh = DBI->connect($datasource, $credentials) The parent driver handle is also created automatically when the database handle is created. (Connection and disconnection get a closer look in an upcoming section of this chapter.) MySQL allows multiple simultaneous connections when using methods such as the CLI; connections using the DBI have the same capability. Therefore, multiple database handles can be created that attach to the same database. Further, each database handle is a completely separate object; you need not worry about commands or results colliding with each other.
If you are looking for cheap and quality webhost to host and run your website check Jboss Web Hosting services.