Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem while running DBI program

Status
Not open for further replies.

unirams

Programmer
Dec 25, 2001
20
IN
Hi,

While running my perl program which intend uses DBI methods to connect to MySQL database, i am getting the following error.

Can't locate loadable object for module DBI in @INC (@INC contains: /usr/local/lib/perl5/5.6.1/sun4-solaris /usr/local/l
ib/perl5/5.6.1 /usr/local/lib/perl5/site_perl/5.6.1/sun4-solaris /usr/local/lib/perl5/site_perl/5.6.1 /usr/local/lib/per
l5/site_perl/5.005/sun4-solaris /usr/local/lib/perl5/site_perl/5.005 /usr/local/lib/perl5/site_perl . /usr/local/mysql-3
.21.33b-sun-solaris2.6-sparc/perl/DBI) at test.pl line 8
Compilation failed in require at test.pl line 8.
BEGIN failed--compilation aborted at test.pl line 8.

Can anyone help me to solve this one.

Thanks in advance.

R.M.Ram
 
A. Need to see source code, or snippet.
B. Is the DBI module installed on your server?

"My eyes are burning, it's time to go to sleep : )"

N-
 
Sounds as if either DBI or DBD::MySQL is not installed. Mike
________________________________________________________________________________

"Experience is the comb that Nature gives us, after we are bald."

Is that a haiku?
I never could get the hang
of writing those things.
 
Please find the code below.

sub BEGIN
{
push (@INC,"/usr/local/mysql-3.21.33b-sun-solaris2.6-sparc/perl/DBI");
}
foreach $i (@INC)
{
print $i;
print "\n";
}
print "Tet";
#use DBI;

#my @drivers=DBI->available_drivers();
#die "No drivers found" unless @drivers;

foreach my $Driver (@drivers)
{
print "Driver: $Driver\n";
# my @datasources = DBI->datasources($Driver);
# foreach my $Datasource (@datasources)
{
# print "Data source is $Datasource\n";
}
# print "\n";
}
exit;

Thanks
R.M.Ram
 
unirams,

At what point do you get your error? I'm guessing that you realise the above code will not work with the lines you've commented out. Mike
________________________________________________________________________________

"Experience is the comb that Nature gives us, after we are bald."

Is that a haiku?
I never could get the hang
of writing those things.
 
The error is saying that Perl can't find the DBI module - are you *sure* you installed DBI? Try re-installing it, and then try running your script again.

For this to work properly, you need
1. *FIRST*, get mysql installed and working
2. Perl installed and working
3. Perl DBI module installed
4. Perl DBD::mysql module installed

If you're still having problems, do 'perl -V' at a command prompt and post the output here. Hardy Merrill
 
I should add that if you already have Perl installed, there is no need to re-install it. Same thing for MySQL.

You can try re-installing DBI and DBD::mysql. Hardy Merrill
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top