PEPPLER.ORG
Michael Peppler
Sybase Consulting
Menu
Home
Sybase on Linux
Install Guide for Sybase on Linux
General Sybase Resources
General Perl Resources
Freeware
Sybperl
Sybase::Simple
DBD::Sybase
BCP Tool
Bug Tracker
Mailing List Archive
Downloads Directory
FAQs
Sybase on Linux FAQ
Sybperl FAQ
Personal
Michael Peppler's resume

sybperl-l Archive

Up    Prev    Next    

From: "Sheree Hemphill" <sah18 at po dot cwru dot edu>
Subject: Using sybperl with cgi
Date: Feb 16 1999 4:04PM

I wrote the following program, which accesses the data correctly when run
from the command prompt:

#!/usr/local/bin/perl
use Sybase::CTlib;
$dbh = new Sybase::CTlib 'sa', 'password', 'helix';
$dbh->ct_sql("use htn");
$data = $dbh->ct_sql("select * from BIA");
foreach $row (@$data) {
	print "$$row[0] - $$row[1] - $$row[2] - $$row[3] - $$row[4] - $$row[5] -
$$row[6] - $$row[7] - $$row[8] - $$row[9] - $$row[10] - $$row[11]\n";
}

What I need to do, however, is run this as a cgi program, returning the
results in a web page.  I attempted this with the following code:

#!/usr/local/bin/perl
use CGI qw(:standard);
use Sybase::CTlib;

$dbh = new Sybase::CTlib 'sa', 'password', 'helix';
$dbh->ct_sql("use htn");
$data = $dbh->ct_sql("select * from BIA");
my(
	$TITLE,
	$cur
);
$TITLE = "BIA Results";
print header, start_html($TITLE), h1($TITLE);
print hr;
print "
\n";
foreach $row (@$data) {
	print "$$row[0] - $$row[1] - $$row[2] - $$row[3] - $$row[4] - $$row[5] -
$$row[6] - $$row[7] - $$row[8] - $$row[9] - $$row[10] - $$row[11]\n";
}
print "
\n"; print hr; print end_html; When I access the url for this, I receive the following error: The context allocation routine failed when it tried to load localization files!! One or more following problems may caused the failure Your sybase home directory is /usr/people/sybase. Check the environment variable SYBASE if it is not the one you want! Cannot access file /usr/people/sybase/config/objectid.dat Sybase::CTlib initialize: cs_ctx_alloc() failed at /usr/freeware/lib/perl5/5.00502/irix-n32/DynaLoader.pm line 187. BEGIN failed--compilation aborted at /var/www/htdocs/helix/cgi-bin/sah18/biares.cgi line 3. Does anyone have any ideas as to what I am doing wrong? Thank you, Sheree