Results 1 to 2 of 2
  1. #1
    Join Date
    Nov 2002
    Posts
    22

    Unanswered: HTML and ODBC problems

    I'm am trying to get simple html page to work with a script using dbi and cgi. It works fine in mysql but when I change the dbname from DBI:mysql:test to DBI:ODBC:HERM which is a totally different database the html and script stop working. Has anyone seen this problem before, and if so could someone please help? Here is the perl code that I'm using.
    Thanks in advance..
    Mario542

    #!c:\perl\bin\perl.exe -wT
    # Get the input for POST method
    read(STDIN,$buffer,$ENV{'CONTENT_LENGTH'});
    #Split the name-value pairs
    ($name,$value)=split(/=/,$buffer);

    # Substitute special character to its original character
    $value=~ tr/+/ /;
    $value=~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C",hex($1))/eg;
    use DBI ;
    use CGI ;
    CGI::ReadParse ();
    $dbname="DBI:ODBC:HERM"
    $user="";
    $passwd="";
    $statement = "UPDATE staf SET name='superman' where name='$value'";
    $dbh = DBI->connect(dbname, $user, $password) || die "$DBI::errstr";
    $sth = $dbh->prepare($statement) ;
    $sth-> execute() ;

  2. #2
    Join Date
    Sep 2002
    Location
    Germany, near Aachen
    Posts
    120

    Re: HTML and ODBC problems

    It works fine in mysql but when I change the dbname from DBI:mysql:test to DBI:ODBC:HERM which is a totally different database the html and script stop working.

    There must be error messages in the web server error log.
    Please post these.

    Also switch on RaiseError, so all errors will cause the script to die and leave an entry in the error log.
    To do this change your connect to:

    $dbh = DBI->connect(dbname, $user, $password, {RaiseError => 1}) || die "$DBI::errstr";

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •