Alternatively, either in one of your Servlets destroy methods (or via webapp context listener, or however you currently do your shutdown logic) get the connection factory and invoke the releaseAllResources method
http://db.apache.org/ojb/api/org/apache/ojb/broker/accesslayer/ConnectionFac tory.html#releaseAllResources() e.g. ConnectionFactoryFactory.getInstance().createFactory().releaseAllResources() ; Cheers Charles -----Original Message----- From: Alexandre Borgoltz [mailto:[EMAIL PROTECTED] Sent: 24 March 2005 07:27 To: OJB Users List Subject: Re: How to shutdown OJB when stopping web context. Nathan, I can see you aren't getting any answer for a few hours so I'll dare my own hint... Maybe you could have OJB use a container-provided datasource instead. For this, use jndi-datasource-name instead of dbalias/driver/user/password/protocol/subprotocol in your <jdbc-connection-descriptor /> http://db.apache.org/ojb/docu/guides/repository.html#jndi-datasource-name For example, your jdbc-connection-descriptor could look like (This is for Oracle, change plaform, driver and url if needed) <jdbc-connection-descriptor batch-mode="true" ignoreAutoCommitExceptions="true" jcd-alias="my-alias" jdbc-level="3.0" jndi-datasource-name="java:comp/env/jdbc/my-datasource" platform="Oracle"> <sequence-manager className="org.apache.ojb.broker.util.sequence.SequenceManagerNextValImpl"> <attribute attribute-name="grabSize" attribute-value="20"/> </sequence-manager> </jdbc-connection-descriptor> And the declaration of the webapp's context in tomcat 4 (server.xml or separate file) is <Context path="/MyWebApp" reloadable="true" docBase="MyWebApp"> <Resource name="jdbc/my-datasource" auth="Container" type="javax.sql.DataSource"/> <ResourceParams name="jdbc/my-datasource"> <parameter> <name>factory</name> <value>org.apache.commons.dbcp.BasicDataSourceFactory</value> </parameter> <parameter> <name>driverClassName</name> <value>oracle.jdbc.driver.OracleDriver</value> </parameter> <parameter> <name>url</name> <value>jdbc:oracle:thin:@hostname:1521:SID</value> </parameter> <parameter> <name>username</name> <value>foo</value> </parameter> <parameter> <name>password</name> <value>bar</value> </parameter> <parameter> <name>maxActive</name> <value>20</value> </parameter> <parameter> <name>maxIdle</name> <value>10</value> </parameter> <parameter> <name>maxWait</name> <value>-1</value> </parameter> </ResourceParams> </Context> In tomcat 5 it should look like: <Context path="/MyWebApp" reloadable="true" docBase="MyWebApp"> <Resource name="jdbc/my-datasource" auth="Container" type="javax.sql.DataSource" factory="rg.apache.commons.dbcp.BasicDataSourceFactory" driverClassName="oracle.jdbc.driver.OracleDriver" url="jdbc:oracle:thin:@hostname:1521:SID" username="foo" password="bar" maxActive="20" maxIdle="10" maxWait="-1" /> </Context> This works great for me. Hope it helps. Alexandre BORGOLTZ Head of Technology SmartJog SA Phone: +33 (0)1 4996 6324 Fax: +33 (0)1 4996 6405 Mobile: +33 (0)6 8882 1417 [EMAIL PROTECTED] Nathan Smith wrote: >Hi all, > >I am looked through the source code, through the archives and searched the >OJB site http://db.apache.org/ojb/, but I can still not figure out how OJB >is shutdown. > >We have a very serious problem with our connection pool at the moment. Part >of that is to do with the connection pool that OJB uses and how it is shut >down. At the moment when I stop our web application context through the >Tomcat Manager it shuts down cleanly. The application's connection pool >shutdown method is called and all connections are closed. The OJB connection >pool is leaving connections open. Once Tomcat is stopped all connections are >closed as indicated by the Database monitor. > >I would like for all connections to be closed when our web context is >stopped. How can this be done for OJB? > >Any help greatly appreciated. > > > > >Nathan Smith >Software Developer >LabPro 2000 Limited >Phone: +64 4 586 6840 >Facsimile: +64 4 586 6841 >[EMAIL PROTECTED] >www.labpro2000.com >Level 6, Riverside Tower on Daly, 15 Daly Street >Lower Hutt, New Zealand > > > > >--------------------------------------------------------------------- >To unsubscribe, e-mail: [EMAIL PROTECTED] >For additional commands, e-mail: [EMAIL PROTECTED] > > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] ___________________________________________________________ HPD Software Ltd. - Helping Business Finance Business Email terms and conditions: www.hpdsoftware.com/disclaimer --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
