mySQL is a Open Source SQL database. Many perl scripts use mySQL and many web hosts support it.

 

To develop scripts using mySQL, you don't have to be connected to the internet and access the database on your web host. You can download the mySQL server and install it on your own computer for testing purposes.

 

mySQL is available at http://www.mysql.com/.

 

icon_exclaim Most web hosts that provide virtual hosting, have one mySQL server for all their customers and each customer is assigned a database. If your web hosts has only given you a database name and a password, this is the case for you also. We recommend emulating this offline, by creating a database in your local mySQL server, with the same name as the one provided to you.

 

icon_idea Notice the following code as an example:

 

use DBI;

my $dbh = DBI->

connect('DBI:mysql:username:mysql.mysite.com','username','password',{RaiseError=>1});

 

my $insert_handle =

           $dbh->prepare_cached('INSERT INTO table1 VALUES (?)');

 

$insert_handle->execute('data');

$dbh->disconnect;

 

If you are running mySQL server offline, and have not mapped your remote mySQL server to localhost, you would use the following to connect to it:

 

my $dbh = DBI->

connect('DBI:mysql:username:localhost','username','password',{RaiseError=>1});

 

So before uploading you would have to change the above to the first code. This can be done using the version converter.

 

Top  Previous  Next