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: Intermediate:
DBI connection "error"

 



seth_h
New User

Dec 19, 2003, 1:23 PM

Post #1 of 2 (1926 views)
DBI connection "error" Can't Post

HELP! When I try to connect to my database I am getting the following "error." (I used quotes for a reason) When I run my script from a command prompt, it connects to the database and returns all rows exactly as expected. When I run it from a web browser, though, I get the following error message:

Can't call method "prepare" on an undefined value at C:\cgi-bin\returnauction.cgi line 7.

This is my DBI initialization:
$database = DBI->connect ("DBI:ODBC:AuctionData",{PrintError => 1, RaiseError => 1});


I don't understand how the connection to my database can be OK when run from a prompt, but be undefined when run from a browser. Any help is very much appreciated as I think that Google is getting tired of spitting out worthless results to my requests. Thanks.

--Seth




davorg
Thaumaturge / Moderator

Dec 20, 2003, 9:30 AM

Post #2 of 2 (1922 views)
Re: [seth_h] DBI connection "error" [In reply to] Can't Post

Sounds like it's a problem with the DBI connection from your web server. What web server are you using? Do any other programs connect to the database successfully?

You should really check the value returned from the "connect" function and take appropriate action at that point rather than waiting until the "prepare" fails.

--
Dave Cross, Perl Hacker, Trainer and Writer
http://www.dave.org.uk/
Get more help at Perl Monks

 
 


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

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