Pramod Sokke writes:
> >There's an Apache::Sybase::DBlib module floating around somewhere that
> >you could use if you don't want to make all those changes.
>
> I'm right now using that module and it's with that module that I'm getting
> the message in my error logs about establishing connection to db for every
> connect call. That's what has left me totally confused whether it's
> actually using the established connection or not.
You're going to get a fresh connection for each apache child process
when that process' connect() call is called. On subsequent calls you
should not get this.
You could verify this by adding:
sub connect {
my($self, @args) = @_;
my($Uid, $Pwd, $Srv) = @args;
my $idx = join ":", (@args) || (@{$self});
return $Connected{$idx} if $Connected{$idx};
print STDERR "($$) connecting to $idx...\n" if $main::DEBUG;
#---------------^^^^^^^
$Connected{$idx} = Sybase::DBlib->dblogin($Uid, $Pwd, $Srv);
}
which will include the process id of the process connecting.
>
> >However, in general it's a lot better if you can avoid having API
> >calls all over the place.
> >For example in the app I'm currently writing there is only 1
> >subroutine that calls the database API (Sybase::CTlib, in this case).
> >
> >This adds a bit of overhead in the perl code, but cuts *way* down on
> >the code maintenance!
>
> I totally agree with you on this, but I'm helpless here because I have to
> work with already existing code that has API calls all over the place.
I understand that - just a general comment.
Michael
--
Michael Peppler -||- Data Migrations Inc.
[EMAIL PROTECTED] -||- http://www.mbay.net/~mpeppler
Int. Sybase User Group -||- http://www.isug.com
Sybase on Linux mailing list: [EMAIL PROTECTED]