I would expect the connection to be exactly the same as it was when you last left it when you use db2_pconnect.
From the php manual: Calling db2_close() on a persistent connection always returns TRUE, but the underlying DB2 client connection remains open and waiting to serve the next matching db2_pconnect() request.
I suspect that if you want to set the schema and use persistent connections, you are going to have to set the schema on every connection. Not a big deal really, it doesn't take much in the way of resources. Or you could just use qualified references on the few queries that need them. Not a big fan of qualified references, they make testing and promoting to a different environment harder, just an option.
Mark Murphy
STAR BASE Consulting, Inc.
mmurphy@xxxxxxxxxxxxxxx
-----web400-bounces@xxxxxxxxxxxx wrote: -----
To: "Web Enabling the AS400 / iSeries" <web400@xxxxxxxxxxxx>
From: Matt Lavinder
Sent by: web400-bounces@xxxxxxxxxxxx
Date: 11/30/2011 10:01AM
Subject: [WEB400] PHP db2_pconnect- SET SCHEMA question
I am using db2_pconnect to establish a persistent connection and I change
the default schema using "SET SCHEMA" for certain queries. I generally
use a wrapper to retrieve my connection and always initialize with
the i5_lib option, but my concern is what happens if I do not? Try as I
may I have not found documentation on the behavior of db2_pconnect when it
comes to a default schema. How and when does db2_pconnect reset the
default schema? Does it always initialize the default schema for each
connection even when the i5_lib option is not provided? My concern is that
the schema change made in one session will persist to the next.
I know the library list changes stay persist, but my hope is that the
default schema is reset with each new connection/session.
As an Amazon Associate we earn from qualifying purchases.