J INFO Formerly known as Jalaram Infotech Web Hosting, Web Design Company Ahmedabad, Gujarat, India
Domains Web Hosting Web Designing Portfolio Support Payment Contact
We are one of the largest Domain Registation & Web Hosting Company of Ahmedabad, Gujarat, India. Web Hosting Ahmedabad, Ahmedabad Web Hosting, Web Hosting Gujarat, Rajkot Web Hosting, Baroda Web Hosting, Bhavanagar Web Hosting , Surat Web Hosting, Web Hosting India.
India : +91-98255-72500
We are one of the largest Domain Registation & Web Hosting Company of Ahmedabad, Gujarat, India. Web Hosting Ahmedabad, Ahmedabad Web Hosting, Web Hosting Gujarat, Rajkot Web Hosting, Baroda Web Hosting, Bhavanagar Web Hosting , Surat Web Hosting, Web Hosting India.
USA : +1-800-789-9620
We are one of the largest Domain Registation & Web Hosting Company of Ahmedabad, Gujarat, India. Web Hosting Ahmedabad, Ahmedabad Web Hosting, Web Hosting Gujarat, Rajkot Web Hosting, Baroda Web Hosting, Bhavanagar Web Hosting , Surat Web Hosting, Web Hosting India.
UK : +44-1312-770783
Fast, Reliable, Affordable Web Hosting, We are one of the largest Domain Registation & Web Hosting Company of Ahmedabad, Gujarat, India. Web Hosting Ahmedabad, Ahmedabad Web Hosting, Web Hosting Gujarat, Rajkot Web Hosting, Baroda Web Hosting, Bhavanagar Web Hosting , Surat Web Hosting, Web Hosting India.
Jalaram Infotech
Domain Registration
Jalaram Infotech Register Domain
Jalaram Infotech Request Offline
Jalaram Infotech Pricing
Jalaram Infotech Features
Jalaram Infotech Web Hosting
Jalaram Infotech Technical Support
Domain Registration
Contact Information
Registered Office
J-INFO - Jalaram Infotech
171, New Cloth Market,
Outside Raipur Gate,
Ahmedabad - 380002,
Gujarat, INDIA.
Phones:
+91-79-22165501 - 66304141
Mobile : +91- 9825572500
Mobile : +91- 9909422429

USA : +1-800-789-9620
UK : +44-1312-770783
E-mail :
Working Hours:
10.00 AM to 8.00 PM
(+5:30 GMT)
(Monday - Saturday)
Contact Information
 
Support Help
Scripting
How do I connect to a MySQL database using Perl?
You may use Perl and the DBI Perl Module to access your mySQL database. See below for a commented example:

#!/usr/bin/perl

use DBI;

# Connect To Database
# * The DBI interface to MySQL uses the method "connect" to make a
# * connection to the database. It takes as it's first argument
# * the string "DBI:mysql:database:hostname", where database is equal
# * to the name of your database, and hostname to the server that it's
# * located on. The second and third arguments, respectively, should
# * be your account username and password. The connection is assigned.
# * to a variable that is used by most other methods in the module.
$database = "your database name";
$username = "your database username";
$password = "your database password";
$hostname = "your database hostname";
$db = DBI->connect("DBI:mysql:$database:$hostname", $username, $password);

# Execute a Query
# * executing a query is done in two steps. First,
# * the query is setup using the "prepare" method.
# * this requires the use of the variable used to
# * initiate the connection. Second, the "execute"
# * method is called, as shown below.
$query = $db->prepare("SELECT * FROM test");
$query->execute;

# How many rows in result?
# * the "rows" method using the variable name the
# * query was executed under returns the number
# * of rows in the result.
$numrows = $query->rows;

# Display Results
# * the fetchrow_array method executed on the
# * query returns the first row as an array.
# * subsequent calls return the other rows in
# * sequence. It returns zero when all rows have
# * been retrieved.
while (@array = $query->fetchrow_array) {
($field1, $field2, $field3) = @array;
print "field1 = $field1, field2 = $field2, field3 = $field3 n";
}

# Cleaning Up
# * with the DBI module, it is a good idea to clean up by
# * explicitly ending all queries with the "finish" method,
# * and all connections with the "disconnect" method.
$query->finish;
$db->disconnect;

exit(0);
Jalaram Infotech
All Rights Reserved by www.jinfo.net A Jalaram Infotech Group of Companies Ahmedabad, Gujarat, India.
A Jalaram Infotech Group of Companies Ahmedabad, Gujarat, India