Home: Perl Programming Help: DBI:
Can't locate object method "connect" via package "dbi"...



peji
Novice

Feb 17, 2003, 5:22 AM


Views: 15745
Can't locate object method "connect" via package "dbi"...

i keep on getting this message..i have already installed dbi..is the problem in my code (sample code)
*********
use DBI;
$driver = "dbi";
$database = "infordb";
$user="zup";
$password="zuppie";
$dsn = "DBI:$driver:database=$database;host=$hostname";
$dbh = dbi->connect($dsn, $user, $password);
*******
another thing... i cant install dbd-mysql coz "dbd-mysql is not intended for my perl build (MSWin32-x86-multi-thread)"... does this mean i have to install another version of perl?... any help is highly appreciated...thanks..
cowit crackling


Paul
Enthusiast

Feb 17, 2003, 6:43 AM


Views: 15743
Re: [peji] Can't locate object method "connect" via package "dbi"...

Pay more attention to case.

dbi->connect

...is not the same as:

DBI->connect


peji
Novice

Feb 17, 2003, 7:17 AM


Views: 15739
Re: [Paul] Can't locate object method "connect" via package "dbi"...

thanks a lot!

..but i have one more prob...

**********
CGI Error
The specified CGI application misbehaved by not returning a complete set of HTTP headers. The headers it did return are:


Database handle destroyed without explicit disconnect.

**********
What does this mean?...i'm totally new to this and no one to teach me...
cowit crackling


erichmusickwc
Novice

Mar 4, 2003, 3:08 PM


Views: 15715
Re: [peji] Can't locate object method "connect" via package "dbi"...

Hmm....

First off one problem I see in the code is that you set $driver equal to dbi. What should go here is a special code for the database software you are running. For example, I use DBI with mysql, so I would put mysql for $driver.

Second, try adding $dbh->disconnect(); after the code you listed. (This should fix the warning "Database handle destroyed without explicit disconnect."

Also, do you print the content-type header anywhere?


peji
Novice

Mar 5, 2003, 2:14 AM


Views: 15711
Re: [erichmusickwc] Can't locate object method "connect" via package "dbi"...

great! thanx man! :)
cowit crackling


Jasmine
Administrator / Moderator

Mar 5, 2003, 7:43 AM


Views: 15709
Re: [peji] Can't locate object method "connect" via package "dbi"...

Sounds like you may have forgotten to $dbh->disconnect();


Paul
Enthusiast

Mar 5, 2003, 10:40 AM


Views: 15707
Re: [Jasmine] Can't locate object method "connect" via package "dbi"...

That shouldn't cause a fatal error. I guess the error can be seen in the error log.


peji
Novice

Mar 9, 2003, 2:55 AM


Views: 15698
Re: [Paul] Can't locate object method "connect" via package "dbi"...

thankx guys!:)
cowit crackling