busunsl has asked for the wisdom of the Perl Monks concerning the following question:
I started working on a small web application that shows reports based on data in a Sybase database.
The application will run on Linux or Solaris, but development is on win32 ( :-( ) for the moment.
When the first script was ready, I tested it on the commandline. Easy piece thanks to CGI.
Ok, time to have it served by Apache: Server Error!
Ahh! Apache thinks it is clever not to pass environment variables to cgi scripts and that's perfectly ok! But I need the SYBASE variable.
Ok, there's the old hack: Place a BEGIN block at the start of the script, set the SYBASE variable in it, and everything's fine.
So I thought, but it didn't work.
I unset the SYBASE variable in a command window and stripped down the script to the smallest working piece and got this to prove the failure:
This yields the error:#!/perl/bin/perl -w BEGIN { $ENV{SYBASE} = 'c:\w03g\sybase\r120500'; } use strict; use warnings; use DBI; system('echo %SYBASE%'); my $dbh = DBI->connect('dbi:Sybase:server=myserver', 'user', 'password' ) or die "could not connect"; # die message cut down here for shortness.
The context allocation routine failed when it tried to load localizati +on files!!<br> One or more following problems may caused the failure<p> Your sybase home directory is as. Check the environment variable SYBAS +E if it is not the one you want!<br> Cannot access file as\ini\objectid.dat<br> install_driver(Sybase) failed: DBD::Sybase initialize: cs_ctx_alloc() +failed at C:/Perl/lib/DynaLoader.pm line 225.<br> Compilation failed in require at (eval 1) line 3.
This is on WinNT SP6, ActiveState Perl 5.6.1 Build 626. DBD::Sybase 0.91
I knew that the BEGIN hack was working on Linux. Being too lazy to start the Linux box and the Sybase server on it, I tried the script on a Sun box running Solaris 2.8.
I unset the SYBASE variable, started the script and everything was fine.
So why doesn't the BEGIN hack work on win32?
p.s.: I managed to convince Apache to pass the SYBASE variable with 'PassEnv SYBASE' in the config file.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: DBD::Sybase and win32
by MZSanford (Curate) on Feb 01, 2002 at 09:04 UTC | |
by busunsl (Vicar) on Feb 01, 2002 at 09:13 UTC | |
Re: DBD::Sybase and win32
by mpeppler (Vicar) on Feb 01, 2002 at 19:11 UTC | |
Re: DBD::Sybase and win32
by dmmiller2k (Chaplain) on Feb 01, 2002 at 18:43 UTC |