DBI and Microsoft Access

Discussion in 'Perl Misc' started by nathaniel_welch@hotmail.com, Mar 9, 2005.

  1. Guest

    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
    , Mar 9, 2005
    #1
    1. Advertising

  2. Guest

    > 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

    =----
    , Mar 10, 2005
    #2
    1. Advertising

  3. * wrote:
    >
    > > 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.


    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
    Fabian Pilkowski, Mar 11, 2005
    #3
  4. Guest

    Fabian Pilkowski wrote:
    > * wrote:
    > >
    > > > 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.

    >
    > 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


    > 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
    , Mar 11, 2005
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Charles A. Lackman
    Replies:
    1
    Views:
    1,340
    smith
    Dec 8, 2004
  2. ulloa
    Replies:
    1
    Views:
    523
    Juha Laiho
    Jul 22, 2004
  3. SpamProof
    Replies:
    0
    Views:
    544
    SpamProof
    Oct 21, 2003
  4. Jerome Hauss
    Replies:
    0
    Views:
    166
    Jerome Hauss
    Oct 13, 2004
  5. Asby

    Mason, DBI, and DBI::Pg

    Asby, Jul 24, 2003, in forum: Perl Misc
    Replies:
    0
    Views:
    173
Loading...

Share This Page