how to unregister jdbc driver when webapplication is stopped

Hello

I am using vaadin with tomcat and with a jdbc datasource

I have got the following message in the tomcat logs when I stop tomcat:

the web application
[/myapplication] registered the JBDC driver [org.postgresql.Driver]
but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistered.

how to/where can I unregister the jdbc driver?

I have the following code in my application class:

public static DataSource getDs() {

		if (ds == null) {
			Context ctx = null;
			try {
				ctx = (Context) new InitialContext().lookup("java:comp/env");
			} catch (NamingException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
			try {
				Dproject.ds = (DataSource) ctx.lookup("jdbc/dproject");
			} catch (NamingException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}

		}

		return ds;
	}

where to put my unregistering code? Which method/interface should I override/implement?

Peter

See
this post
.

thanks for your answer it looks like a proper solution to my problem :slight_smile: