sql:close only closes connections that were created from query/pquery that were created against a specific
XConnection. So say you have 1 stylesheet that creates an XConnection as stores it in a global variable and
all the included stylesheets access that variable, then yes you only need one sql:close() at the end of the main
stylesheet. Now if you have one stylesheet that imports/includes other stylesheets and each of those stylesheets
create their own XConnection, even though the connection information is the same, each stylesheet
will be responsible for calling sql:close(). Also you need to be careful that you call sql:close before any
<xsl:message terminate="yes" /> statements. Xalan does not have a mechanism where it informs Documents
when they are being discarded, if so we could put in some code to auto close any open connections.


-JG

Eric Everman wrote:

Thanks again- I'd better go back and add sql:close to my sheets. Based on the bug you describe, should only the parent XSLT sheet call sql:close()? For example, if a parent sheet includes several child sheets and they all specify the same connection information (I typically do this for querying master-detail information), would calling sql:close() in a child sheet close *all* the similar connections, even if they are still in use?

Also, could you comment on allowing XConnection to auto-wrap a JNDI datasource? Would people be receptive to this as a contribution? I've not yet looked at the code, so I'm not sure how complex this would be...

Thanks,
--ee


On Mar 1, 2005, at 2:56 PM, John Gentilin wrote:

Morris Kwan wrote:

Must I explicitly close the connection?

I guess it is not explicitly closed. You need to call
sql:setFeature($connection, 'default-pool-enabled', 'false') to close the
connection.




Oops, I missed that one. The SQL extension does not close connections automatically. You MUST
call sql:close() at the end of the Stylesheet. Disabling the default connection pool will only release
connections that are currently not in use.


Just a little FYI...
The XConnection class does not represent a single DB connection. It is really a query factory where
each query is associated to a DB connection. XConnection is a legacy class name that was kept around.


The sql:close() function will close all connections (i.e. queries) that were created with an XConnection.

The mechanism to close a specific query is currently broken, I need to write up a detailed JIRA bug

-JG



--
--------------------------------------
John Gentilin
Eye Catching Solutions Inc.
18314 Carlwyn Drive
Castro Valley CA 94546

   Contact Info
[EMAIL PROTECTED]
Ca Office 1-510-881-4821
NJ Office 1-732-422-4917




Reply via email to