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 thes

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 1 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. Thank again (to you

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 > 1 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
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 expect

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) ambiente.look

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); Connec

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"); resul

RE: How to close open connections after application stop?

2009-02-22 Thread Martin Gainty
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 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: After application stop (using tomcat manager) I'd like to (drastic example) rename the db, but I can't do it because there are open connections. There ar

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: >>> >>> >>> >> 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 Edoardo Panfili
Mark Thomas ha scritto: Edoardo Panfili wrote: Hy, I have one webapp in Tomcat 6.0.18 with this context: After application stop (using tomcat manager) I'd like to (drastic example) rename the db, but I can't do it because there are open connections. There are no other application using

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: > > > type="javax.sql.DataSource" > maxActive="8" maxIdle="5" maxWait="300" > username="myApp" password="passwd" > driverClassName="org.postgresql.Driver" > url="jdbc:postgresq