Error when connecting to database using Win32::ODBC

Discussion in 'Perl Misc' started by madan, Jun 9, 2006.

  1. madan

    madan Guest

    hi all,
    i am getting a error when i use Win32::ODBC..Please check it out and
    see weather its working on ur systems..i need to connect to database...
    #! /usr/bin/perl

    use lib '/cgi-bin/lib';
    require("CGI.pm");
    use CGI::Carp 'fatalsToBrowser';
    use CGI;
    use Win32::ODBC;
    my $cgi = CGI->new;
    $dbh= new Win32::ODBC("dsn=test");
    print $cgi->header( 'text/html' );
    print $cgi->start_html;
    print $cgi->startform("get","/cgi-bin/data.cgi");
    if(!$dbh)
    {
    &printFailure;
    exit();
    }
    else
    {
    &printSucess;
    }

    sub printFailure {
    print "failure in connecting <br>".Win32::ODBC::Error();
    }
    sub printSucess {
    print "Connection Sucessful<br>";
    }
    print $cgi->endform;
    print $cgi->end_html;
    ############################
    The following error is coming only when i use Win32::ODBC module..
    when i removed it the program is working fine..I checked the dsn,user
    name and password all are right...
    the following error is shown on the browser..
    ##########################################################################
    Undefined subroutine &Scalar::Util::blessed called at
    W:/usr/lib/overload.pm line 89.
    Compilation failed in require at W:/usr/lib/Config.pm line 70.
    Compilation failed in require at W:/usr/site/lib/Win32/ODBC.pm line 27.
    Compilation failed in require at W:/cgi-bin/dbtest.pl line 7.

    BEGIN failed--compilation aborted at W:/cgi-bin/dbtest.pl line 7.
    ############################################################################
    i am new to perl...so i dont have enough stuff to write a good
    syntax...
    thanks in advance
     
    madan, Jun 9, 2006
    #1
    1. Advertising

  2. madan

    David Squire Guest

    madan wrote:
    > hi all,
    > i am getting a error when i use Win32::ODBC..Please check it out and
    > see weather its working on ur systems..i need to connect to database...
    > #! /usr/bin/perl


    missing:

    use strict;
    use warnings;

    # get Perl to help you help yourself before asking here.

    > require("CGI.pm");

    ....
    > use CGI;


    Which of these do you mean (almost certainly the second)? This problem
    has already been pointed out to you, as have others still in your code.
    Read, understand, and act on advice rather than just reposting your problem.

    DS
     
    David Squire, Jun 9, 2006
    #2
    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. moid
    Replies:
    1
    Views:
    489
  2. ruds
    Replies:
    13
    Views:
    927
  3. Wes Gamble
    Replies:
    1
    Views:
    172
    Gerardo Santana Gómez Garrido
    Apr 5, 2006
  4. Jim Roberts
    Replies:
    7
    Views:
    255
    Bart Lateur
    Jan 4, 2006
  5. madan
    Replies:
    3
    Views:
    242
    Sherm Pendley
    Jun 12, 2006
Loading...

Share This Page