I have written the fowwing script to see if DBI is working.
#!/usr/bin/perl
use DBI;
use strict;
my $dbh = DBI->connect('DBI:mysql:rush_load', 'root',
'rr8663');
die "connect failed: $DBI::errstr" unless $dbh;
my $sth = $dbh->prepare("insert into tablename
(name,email,phone_number)
values
('Bill Watkins','Bill@stripped','601-353-8671')
");
die "prepare failed:", $dbh->errstr unless $sth;
$sth->execute;
$sth->execute or die "execute failed:", $sth->errstr;
$dbh->disconnect;
When I run it I get the following error:
[root@localhost DBI-1.08]# perl rush2.pl
Can't locate loadable object for module DBI in @INC (@INC contains:
/usr/lib/perl5/i386-linux/5.00404 /usr/lib/perl5
/usr/lib/perl5/site_perl/i386-linux /usr/lib/perl5/site_perl .) at
DBI.pm line 0
BEGIN failed--compilation aborted at DBI.pm line 150.
BEGIN failed--compilation aborted at rush2.pl line 3.
I have installed the DBI module in the following directory:
[root@localhost DBI-1.08]# pwd
/usr/bin/DBI-1.08
[root@localhost DBI-1.08]# ls -la
total 365
drwxr-xr-x 6 300 wheel 1024 Aug 1 21:55 .
drwxr-xr-x 3 root root 13312 Jul 29 21:33 ..
-r--r--r-- 1 300 wheel 23886 May 12 20:44 Changes
-r--r--r-- 1 300 wheel 124877 May 12 20:44 DBI.pm
-r--r--r-- 1 300 wheel 74387 May 12 20:44 DBI.xs
-r--r--r-- 1 300 wheel 15843 May 8 20:14 DBIXS.h
-r--r--r-- 1 300 wheel 11537 May 8 20:14 Driver.xst
-r--r--r-- 1 300 wheel 1659 Apr 9 16:49 MANIFEST
-rw-r--r-- 1 root root 25731 Jul 14 21:24 Makefile
-r-xr-xr-x 1 300 wheel 6605 Jan 5 1999 Makefile.PL
-rw-r--r-- 1 root root 17383 Jul 13 22:19 Perl.c
-r--r--r-- 1 300 wheel 394 Jan 3 1999 Perl.xs
-rw-r--r-- 1 root root 11485 Jul 13 22:19 Perl.xsi
-r--r--r-- 1 300 wheel 5013 Apr 9 16:50 README
-r--r--r-- 1 300 wheel 5472 May 12 20:44 ToDo
drwxr-xr-x 6 root root 1024 Jul 13 22:18 blib
-r--r--r-- 1 300 wheel 2050 Jan 1 1999 dbd_xsh.h
-r--r--r-- 1 300 wheel 1374 Aug 14 1998 dbi_sql.h
-r--r--r-- 1 300 wheel 5500 Apr 9 16:51 dbiproxy.PL
-r--r--r-- 1 300 wheel 741 Aug 14 1998 dbish.PL
drwxr-xr-x 6 300 wheel 1024 May 12 20:45 lib
-rw-r--r-- 1 root root 0 Jul 13 22:19 pm_to_blib
-rw-r--r-- 1 root root 543 Jul 29 21:00 rush2.pl
drwxr-xr-x 2 300 wheel 1024 May 12 20:45 t
drwxr-xr-x 2 root root 1024 Jun 24 21:52 test
-r--r--r-- 1 300 wheel 3416 Jan 1 1999 test.pl
Can anyone please tell me what I have done wrong and what I must do to
fix it.