ADDR Logo Effective Online Solutions
home | about us  | solutions | partners | careers | contact
1-877-528-4850 |   Chat with a Rep   |   Order Now Help Center   |   Control Panel 
 
  HELP CENTER
 
Getting Started
FAQ - List of Frequently Asked Questions
How Tos
I am having a problem with...
Explanation of features
For advanced users
Glossary of terms
Searching
Quick submission forms for setup requests and reporting problems
 
Your Question Was...
  How do I connect to a mySQL database using PERL?
 
The script below is an example of how you may connect to a MySQL database using Perl. You may also use it to test connectivity to your database. Remember to substitute your own information as necessary, for your particular database configuration. The $DBHost variable MUST remain as stated at this point in time in order to connect to the MySQL server.

This script requires permissions of: 755.


#!/usr/bin/perl -w

use DBI;
use strict;

my $DBName = "(your database name)";
my $DBUser = "(your database user name)";
my $DBPass = "(your database password)";
my $DBHost = "mysql.addr.com";

my $dsn = "DBI:mysql:$DBName;$DBHost";
my $dbh = DBI->connect($dsn, $DBUser, $DBPass);

if ( !defined $dbh )
{
print "\nDatabase connectionfailed\n\n";
exit;
}
else
{
print "\nConnection to mySQL database successful.\n\n";
}

$dbh->disconnect;

 
 
 
CONTROL PANEL  
Username
Password
 
CORPORATE INFO
AT A GLANCE STATS
  Pages served today:
44429662
Emails processed today:
3959391
Today's new clients:
177
 
HELP CENTER    
  1-877-528-4850
  Live Chat
  We'll Call You
SITE MAP  
 TESTIMONIALS  
All Testimonials
  About ADDR.com : Web Hosting : Web Design : E-Commerce : Reseller Program : Affiliate Program : Domain Lookup : Privacy Policy : Contact Us
   Copyright © 1997 - 2007 ADDR.com, Inc. All rights reserved.