CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: DBI: Connecting MYSQL Database using Perl: Edit Log



Murali
New User

Feb 26, 2008, 1:38 AM


Views: 7332
Connecting MYSQL Database using Perl

Hi,

I have installed Perl 5 to my Windows, But when try to connect the mysql database using the perl script, it is throwing some error.

Here is my code

Use Mysql;

## connect to mySQL database:
$DBHOST = "localhost";
$DBNAME = "mydatabase";
$DBUSER = "root";
$DBPASS = "passwd";

$DB = Mysql->connect($DBHOST, $DBNAME, $DBUSER, $DBPASS);

## Query to the database:

$SQuery = qq~CREATE TABLE member(member_id INTEGER NOT NULL,member_name VARCHAR(100),member_status TINYINT DEFAULT 1 NOT NULL)~;


Error:

E:\Perl>perl dbtest.pl
Can't locate Mysql.pm in @INC (@INC contains: E:/Perl/lib E:/Perl/site/lib .) at
dbtest.pl line 2.
BEGIN failed--compilation aborted at dbtest.pl line 2.

Can some one clarify this?.

Whether I need to add MYSQL Connectors to any specified path of the Perl Installed directory?

Some one provide me a simple example for executing a simple query using perl with mysql on windows
-Murali

(This post was edited by Murali on Feb 26, 2008, 1:42 AM)


Edit Log:
Post edited by Murali (New User) on Feb 26, 2008, 1:42 AM


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives