VoiceXML Forum Community Message Board


Post New Topic  Post A Reply
my profile | register | search | faq | forum home
  next oldest topic   next newest topic
» VoiceXML Forum Community Message Board   » Newbies   » SQL and perl problem

 - UBBFriend: Email this page to someone!    
Author Topic: SQL and perl problem
Uli
Junior Member
Member # 3759

Rate Member
Icon 1 posted August 28, 2006 04:29 PM      Profile for Uli   Email Uli   Send New Private Message       Edit/Delete Post   Reply With Quote 
The problem:
I am able to connect to the SQL database using perl in a standalone program.
I am able to send in and return the userid and pin from the perl program written in Perl.
The problem comes when I put the database access and the vxml code together as below.

The error:
ERROR error.badfetch.http.502: 'http://myserver/SQL.pl: Bad Gateway
Error
Error in CGI Application
CGI Error
The specified CGI application misbehaved by not returning a complete set of HTTP headers.

The code:
#!/usr/bin/perl -w

use strict;
use CGI;
use DBI;

my $q = new CGI;
my $userid = $q->param('CustomerNum');

$dbHandle = (DBI->connect('DBI:ODBC:****',
'*************',
'*************'));

$sql = "SELECT ClientID from tblContact where BicId = 123";
$statementHandle = $dbHandle->prepare( $sql );

$statementHandle->execute() || die $statementHandle->errstr;

$arrayRef = $statementHandle->fetchrow_array();

$statementHandle->disconnect();

my $Pin = $arrayRef;

$statementHandle->finish();
$dbHandle->disconnect();

print "Content-Type: text/xml\n\n";
print "<?xml version=\"1.0\"?>\n";
print "<vxml version=\"2.0\" xmlns=\"http://www.w3.org/2001/vxml\">\n";

print "<f.orm>\n";
print "<var name=\"CustomerNum\"/>\n";
print "<var name=\"CustomerPin\"/>\n";
print "<block>\n";

print "Thank you! We are working on your perl request.\n";

print "<assign name=\"CustomerPin\" expr=\"<%=$Pin%>\"/>\n";

print "<assign name=\"CustomerNum\" expr=\"<%=$userid%>\"/>\n";
print "Test\n";
print "<return namelist=\"CustomerNum CustomerPin\"/>\n";
#print "<return/>\n";
print "</block>\n";
print "</f.orm>\n";
print "</vxml>\n";
print "\n";

exit 0;

Thank you for any help with this problem.

Posts: 1 | From: Texas | Registered: Aug 2006  |  IP: Logged


All times are Eastern  
Post New Topic  Post A Reply Close Topic    Move Topic    Delete Topic next oldest topic   next newest topic
 - Printer-friendly view of this topic
Hop To:

Contact Us | VoiceXML Forum



Powered by Infopop Corporation
UBB.classicTM 6.3.1.2