DBI and Microsoft Access

  • Thread starter nathaniel_welch
  • Start date
N

nathaniel_welch

I need some help with connecting to a Microsoft Access database using
DBI. My files are stored on a remote server. I really don't have any
clue why I can't make this work. The error I get really has me
confused as well. I tried the following (where recruit is the DSN
name):

use DBI;
print "Content-type:text/html\n\n";
print "<html><head><title>Test Page</title></head><body>";
print "test1<br><br>";
$dbh = DBI->connect("dbi:ODBC:recruit");
print "test2</body></html>";
exit;

and the error I get is: "CGI Error The specified CGI application
misbehaved by not returning a complete set of HTTP headers.".

I also tried using a DSN less connection, but got the same error.

This exact code works fine in my old environment, but will not work
here. I checked and the DBI module is installed, so that's not the
problem.

Any help would be GREATLY appreciated!

Thanks,
Nate
 
N

nathaniel_welch

What happens when you remove $dbh = DBI->connect("dbi:ODBC:recruit");
from your code?

When I remove or comment that line, the code works fine. It prints
test1 and then test2 to the screen.

And, by the way, the error doesn't change whether I use single or
double quotes around the arguments for the connect.

Len

----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption
=----
 
F

Fabian Pilkowski

When I remove or comment that line, the code works fine. It prints
test1 and then test2 to the screen.

Hence there must be a problem with that line. So far you've posted the
error which will be displayed in your browser. This one was generated by
your webserver because your script hadn't returned a correct output.
Have a look into your webserver's errorlog to find out the errormessage
generated by your script.

Furthermore, you can add the line

use CGI::Carp qw( fatalsToBrowser );

to your script wherethrough all *your* errors will be redirected to your
browser. Especially while writing a script this could be helpful.
And, by the way, the error doesn't change whether I use single or
double quotes around the arguments for the connect.

When initializing a string you can use single or double quotes. Within
double quotes all vars will be interpolated (i.e. replaced by their
values), but not within single ones. Since you've no vars inside your
string you can't see any effect here.

regards,
fabian
 
N

nathaniel_welch

Fabian said:
Hence there must be a problem with that line. So far you've posted the
error which will be displayed in your browser. This one was generated by
your webserver because your script hadn't returned a correct output.
Have a look into your webserver's errorlog to find out the errormessage
generated by your script.

Furthermore, you can add the line

use CGI::Carp qw( fatalsToBrowser );

I added this to my code and realized that the DBD::ODBC driver was not
installed. I emailed the admin and he got it installed for me. Works
now.

Thanks,
Nate
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,266
Messages
2,571,085
Members
48,773
Latest member
Kaybee

Latest Threads

Top