On Mon, 22 May 2000, Ian Kallen wrote:
> I've done everything I can think of to shore up any DB connection
> flakiness but I'm still plagued by errors such as these:
> DBD::Oracle::db selectcol_arrayref failed: ORA-12571: TNS:packet writer
> failure
> ...this is only a problem under mod_perl, outside of the
> mod_perl/Apache::DBI environment everything seems fine. Once the db
> connection is in this state, it's useless until the server gets a restart.
>
> My connect strings look good and agree, I put Stas' ping method in the
> DBD::Oracle::db package, set a low timeout, called Oracle (they don't
> want to hear about it). Everything is the latest versions of
> mod_perl/Apache/DBI/DBD::Oracle connecting to an Oracle 8.1.5 db on
> Solaris. Is Apache::DBI not up to it? (it looks simple enough)
>
> Maybe there's a better persistent connection method I should be looking
> at?
Apache::DBI is dirt simple, and it's the only method I know for persistent
connections. You can just keep your $dbh as a global, but Apache::DBI is
just barely more complex than that.
Your problem is almost certainly coming from Oracle in one way or
another. You may not see this happening with non mod_perl scripts because
they don't live long enough or peform enough queries.
One thing I've encountered is that when the ping method fails in a child
process I can never get a successful reconnect from that same process
again. I get around this by killing that process (Apache::exit()) after
it sends out an error page. New child processes spawned by Apache don't
have any trouble connecting.
This is with Oracle 8 on Linux.
- Perrin