DBD:Sybase and perl cgi

Edhi Nugroho edhinug at stmik-stikubank.ac.id
Fri Jul 7 05:30:45 EDT 2000


Hi,

I'm using perl 5.002 and DBD:Sybase 0.22.I wrote a test script using Perl to
fetch records from my MSSQL Server (WinNT), its works fine as long as I run
it from command prompt, but when I tried to running as cgi-script I got
message (from my Apache logs) "Exec format". What is that means?  I guess
that the err came from line :


DBI->connect("dbi:Sybase:server=192.168.42.2;database=master",'***','****');

FYI, I'm using FreeBSD 2.2.8

What should I do to fix it?

Any ideas/comments are welcome.


TIA
edhinug

Note: all of my cgi scripts are work fine except this script.

#!/usr/local/bin/perl

BEGIN {
 $ENV{SYBASE}='/usr/local/freetds';
 $ENV{TDSVER}='42';
}

use strict;
use DBI;
#use CGI;

#my $s = new CGI;
#print $s->header;
#print $s->start_html("Test DBI");

print "Context-Type:text/html";
print "<HTML>";
my $dbh =
DBI->connect("dbi:Sybase:server=192.168.42.2;database=master",'***','****');

if (! $dbh) {
 print "$DBI::errstr <HTML>";
 die("Error");
}
#my $sql = qq{ SELECT kode_jurusan,nama_jurusan from jurusan_tbl };
my $sth = $dbh->prepare("SELECT kode_jurusan, nama_jurusan from
jurusan_tbl");
$sth->execute();

my( $kode_jurusan, $nama_jurusan);
$sth->bind_columns( undef, \$kode_jurusan, \$nama_jurusan);

print "<TABLE>";
while( $sth->fetch() ) {
  print "<TR>";
  print "<TD>$kode_jurusan</TD>";
}

print "</TABLE>";
$sth->finish();
$dbh->disconnect();
print "</HTML>";







More information about the FreeTDS mailing list