How to close open connections after application stop?

2009-02-22 Thread Edoardo Panfili
Hy, I have one webapp in Tomcat 6.0.18 with this context: Context path=/myApp docBase=myApp debug=100 reloadable=true Resource name=jdbc/myApp auth=Container type=javax.sql.DataSource maxActive=8 maxIdle=5 maxWait=300 username=myApp password=passwd

Re: How to close open connections after application stop?

2009-02-22 Thread Mark Thomas
Edoardo Panfili wrote: Hy, I have one webapp in Tomcat 6.0.18 with this context: Context path=/myApp docBase=myApp debug=100 reloadable=true Resource name=jdbc/myApp auth=Container type=javax.sql.DataSource maxActive=8 maxIdle=5 maxWait=300 username=myApp

Re: How to close open connections after application stop?

2009-02-22 Thread Edoardo Panfili
Mark Thomas ha scritto: Edoardo Panfili wrote: Hy, I have one webapp in Tomcat 6.0.18 with this context: Context path=/myApp docBase=myApp debug=100 reloadable=true Resource name=jdbc/myApp auth=Container type=javax.sql.DataSource maxActive=8 maxIdle=5 maxWait=300

Re: How to close open connections after application stop?

2009-02-22 Thread Mark Thomas
Edoardo Panfili wrote: Mark Thomas ha scritto: Edoardo Panfili wrote: Hy, I have one webapp in Tomcat 6.0.18 with this context: Context path=/myApp docBase=myApp debug=100 reloadable=true Resource name=jdbc/myApp auth=Container type=javax.sql.DataSource maxActive=8

Re: How to close open connections after application stop?

2009-02-22 Thread Edoardo Panfili
Edoardo Panfili ha scritto: Mark Thomas ha scritto: Edoardo Panfili wrote: Hy, I have one webapp in Tomcat 6.0.18 with this context: Context path=/myApp docBase=myApp debug=100 reloadable=true Resource name=jdbc/myApp auth=Container type=javax.sql.DataSource maxActive=8

RE: How to close open connections after application stop?

2009-02-22 Thread Martin Gainty
than intended recipient. Sender does not necessarily endorse content contained within this transmission. Date: Sun, 22 Feb 2009 11:25:42 +0100 From: edoa...@aspix.it To: users@tomcat.apache.org Subject: How to close open connections after application stop? Hy, I have one webapp

Re: How to close open connections after application stop?

2009-02-22 Thread Edoardo Panfili
Martin Gainty ha scritto: javax.sql.DataSource dataSource ; java.sql.Connection connection; java.sql.Statement statement; java.sqlResultset resultSet; code.. try{ connection = dataSource.getConnection(); statement = connection.prepareStatement(SELECT FU FROM BAR);

Re: How to close open connections after application stop?

2009-02-22 Thread Alan Chaney
Edoardo wrote I have resultset.close(); statement.close(); connection.close(); in my code. and connection = dataSource.getConnection(); seems very close to my ambiente = (Context) new InitialContext().lookup(java:comp/env); pool = (DataSource) ambiente.lookup(jdbc/myApp);

Re: How to close open connections after application stop?

2009-02-22 Thread Edoardo Panfili
Alan Chaney ha scritto: Edoardo wrote I have resultset.close(); statement.close(); connection.close(); in my code. and connection = dataSource.getConnection(); seems very close to my ambiente = (Context) new InitialContext().lookup(java:comp/env); pool = (DataSource)

Re: How to close open connections after application stop?

2009-02-22 Thread Edoardo Panfili
Alan Chaney ha scritto: I don't think so. Let me recap your problem: When you undeploy an application from tomcat (using the DBCP pooling mechanism) you can't make STRUCTURAL changes to the database because it complains that connections are still in use. This is exactly what one would

Re: How to close open connections after application stop?

2009-02-22 Thread Mark Thomas
Edoardo Panfili wrote: Using this code in destroy() method of a servlet marked as load-on-startup1/load-on-startup Yep - that is the sort of code you'd need. Using a context listener would be a better solution as Tomcat is free to call destroy() on your Servlet whenever it likes. Mark

Re: How to close open connections after application stop?

2009-02-22 Thread Edoardo Panfili
Mark Thomas ha scritto: Edoardo Panfili wrote: Using this code in destroy() method of a servlet marked as load-on-startup1/load-on-startup Yep - that is the sort of code you'd need. Using a context listener would be a better solution as Tomcat is free to call destroy() on your Servlet

Re: How to close open connections after application stop?

2009-02-22 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Martin, On 2/22/2009 10:26 AM, Martin Gainty wrote: catch (SQLException sqlEx) { try { resultset.close(); statement.close(); connection.close(); } It's kind of silly to call close() on all these