Hi,

I am a newbie and hope someone can she light on why I can't get the
DBD::mysql connection working in my perl script.  The script is a test one
and very simple.  

I have the mysql daemon running and mysqladmin works, and DBI is installed
too.  I went through the installation process for DBD and have also placed
the /usr/local/mysql path reference in the environment.  These are  the
errors below:  

-------------------------------
Can't locate DBD/mysql.pm in @INC (@INC contains:
/opt/perl5/lib/5.6.0/PA-RISC1.1 /opt/perl5/lib/5.6.0
/opt/perl5/lib/site_perl/5.6.0/PA-RISC1.1 /opt/perl5/lib/site_perl/5.6.0
/opt/perl5/lib/site_perl .) at create_table.pl line 8.
BEGIN failed--compilation aborted at create_table.pl line 8.
-----------------------------------------------------------

Script is as follows:

---------------------------------
#!/usr/bin/perl
# Creating a table

use warnings;
use strict;
use DBI;
use DBD::mysql;

my $dbh = DBI->connect("DBI:mysql:USERDB", "root", "", { RaiseError => 1} );
my $string = "CREATE TABLE Users (
                  FirstName VARCHAR( 30 ),
                  LastName  VARCHAR( 30 ),
                  Email     VARCHAR( 30 ),
                  Phone     VARCHAR( 30 ),
                  Continent ENUM( 'North America',
                                  'South America',
                                  'Europe',
                                  'Asia',
                                  'Africa',
                                  'Australia',
                                  'Antarctica' ),
                  OpSys     ENUM( 'Windows NT',
                                  'Windows 98',
                                  'Macintosh',
                                  'Linux',
                                  'HP-UX',
                                  'Other'),
                  Hours     INT,
                  Rating    INT )";

$dbh->do( $string );
$dbh->do( "INSERT INTO Users (
              FirstName, LastName, Email, Phone, Continent, OpSys, Hours,
Rating )
           VALUES ('Harry', 'Varvarigos',
'hvarvari\@test.test.telstra.com.au',
                   '(555)555-5555', 'North America', 'HP-UX 10.20', 3, 4)"
);
my $sth = $dbh->prepare( "SELECT * FROM Users" );
$sth->execute();

while ( my $row = $sth->fetchrow_array() ) {
        print( "@row\n" );
}

warn( $DBI::errstr ) if ( $DBI::err );
$dbh->disconnect();
$sth->finish();


----------------------------------

Thanks for any assistance

Harry
CAUTION - This message may contain privileged and confidential information intended 
only for the use of the addressee named above.  If you are not the intended recipient 
of this message you are hereby notified that any use, distribution or reproduction of 
this message is prohibited.  If you have received this message in error please notify 
Siemens Ltd., ABN 98004347880, or Siemens (NZ) Limited immediately.

---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to