After a several months struggling with it I've been able to use DBI with mod_perl on a HP-UX machine and a Sybase
server.
I had to install DBI 1.43 and DBD Sybase 1.04
There are several issues with this bussines. First of all the question of locating the interfaces file for
Sybase. Using mod_perl you have to initialize Sybase environment for the Apache Web Server. The proper
way is to put the environment script for Sybase into the environment script for Apache. The script for the Apache provided
with HP-UX uses to reside in /opt/hpws/apache/bin/envvars
The one we use has the signature:
HP-UX_Apache-based_Web_Server/2.0.45 (Unix) mod_perl/1.99_08 Perl/v5.6.1 DAV/2 Server at plus.bancoval.es Port 80


We did that, but we still were getting an error when running perl scripts in mod_perl. So we start to tinker with
the environment variables passed by Apache to the CGIs, which was a nonsense tinkering since is the embedded perl
the one which needs the Sybase environment.


The fact is that we wrongly assumed that the error was allways the same, but in
fact were the SYBASE var is not reachable by the interpreter we got something like


[Mon Jun 14 21:32:35 2004] [error] [client 10.105.9.26] File does not exist: /va
r/www/docs/REFLECTION.WEB/ex/com


Open Client Message:
Message number: LAYER = (5) ORIGIN = (3) SEVERITY = (5) NUMBER = (131)
Message String: ct_init(): network packet layer: internal net library error: Att
empt to load protocol driver failed
[Mon Jun 14 21:32:56 2004] [error] 6730: ModPerl::Registry: install_driver(Sybas
e) failed: DBD::Sybase initialize: ct_init(12500) failed at /opt/perl/lib/5.6.1/
PA-RISC1.1-thread-multi/DynaLoader.pm line 225.
Compilation failed in require at (eval 9) line 3.


while if the SYBASE var is properly set we got something like

[Wed Aug 18 12:07:45 2004] [error] 5645: ModPerl::Registry: DBI connect('server=
SYBVAL;charset=iso_1','sa',...) failed: (no error string) at /var/www/cgi-bin/PR
UEBAS/tabla.pl line 27.


New tests and trials proved that the problem was located in the DBI module. Now we have been able
even to make freeze the database server (YES WE HAVE DONE IT). We have a HP-UX machine, we use mod_perl
as before, we use DBI 1.38 and DBD 1.01 and write a small script which just connects and disconnects to a remote
HP-UX SYBASE server (ASE 12.5.0) . If yo run the script from the command line, OK you get the proper messages.
You do that from a browser
invoking the script and still ok. You run the script from mod_perl (We have configured mod_perl so it handles scripts
ending with .pl, otherwise they are executed as CGIs: we link x.pl and x to the same file and we have both uses)


After running the script from mod_perl the remote served froze quite scaring people from SysAdmin AND Sybase
Support people (It was a production environment). In this case the local Web Server logged errors like the second one.
And this is our WARNING
The main symptom is that the listening socket seems to dissapear from a "netstat" list.


Anyway we did some more tests. From the same HP-UX machine with the Apache we tried to freeze a second HP-UX
SYBASE server (12.5 as well) : we repeat the deed. We tried against a SYBASE ASE 12.5 running on a Mac OS X.
It survived. We got the error on the browser, but the server stayed alive.


At last we installed the last DBI (1.43) in the machine with Apache and mod_perl. We had a bit of problems: a
warning about threaded perl and the fact that the
new version uses Test::More which was not installed with HP-UX (just Test::Harness) and then you need Test::Simple (!?)
In the end we installed DBI even the tests were dubious...


We then installed DBD Sybase 1.04 (Which installed OK except for the fact that perl Makefile.PL failed
trying to umask the PWD file: after a couple of tries we just punt a comment before the umask line. To
be reviewed afterwards).


And then, it worked. We were just expecting a new error but instead we got the same result with
both file and file.pl ... Connected ... Disconnected.


We will keep doing some tests before going again against a production environment but it looks like that
now it works. Of course, Sybase guys are looking at it. It seems to easy to freeze a database server from
a remote machine (using a quite unprivileged user).


Next step: a connection pool

Please, stand by...

Miguel Covas O'Ryan

Director de Sistemas de Información
Bancoval, S.A.
Fernando el Santo, 20
Madrid 28010

AVISO LEGAL
Este mensaje de correo electrónico y sus documentos adjuntos están dirigidos
exclusivamente a los destinatarios especificados. Puede contener información
confidencial o legalmente protegida. No hay renuncia a la confidencialidad o
privilegio por cualquier transmisión errónea. Si usted no es el destinatario
indicado, le rogamos que lo elimine y se lo comunique al remitente. No debe,
directa o indirectamente, usar, revelar, distribuir, imprimir o copiar ninguna de las partes de este mensaje. Si siendo destinatario de este mensaje no consintiera el uso de correo electrónico, rogamos nos lo comunique inmediatamente.
Bancoval,S.A. y sus filiales no serán responsables de las opiniones o
informaciones incluidas en este mensaje salvo cuando el remitente esté autorizado para establecer que dichas opiniones proceden de Bancoval,S.A
y sus filiales.


DISCLAIMER
Addressee/s identified herein. It may contain confidential or legally privileged information. No confidentiality privilege is waived or lost
by any mistransmission. If you are not the intended recipient, please
immediately delete it and notify the sender. You must not, directly or
indirectly, disclose, distribute, print, or copy any part of this message.
If you are the addressee of this message and do not consent to the use of
e-mail, please communicate it to us immediately. Bancoval, S.A. and its
subsidiaries are not responsible for the opinions or information included
in this message except when the sender is authorised to state them to be the
views of Bancoval, S.A and its subsidiaries.

Reply via email to