That won't use the pool. Take a look at some of the code snippets at [1]
Nils-H [1] - http://tomcat.apache.org/tomcat-6.0-doc/jndi-datasource-examples-howto.html On Mon, Dec 1, 2008 at 8:09 AM, Adam Ruggles <[EMAIL PROTECTED]> wrote: > > You can use this little snippet to get a connection: > > public Connection getConnection(String url, String driverClassName, > String > username, String password) throws SQLException { > try { > Class.forName(driverClassName); > } catch (ClassNotFoundException e) { > throw new SQLException(e.getMessage()); > } > if (username == null) { > return DriverManager.getConnection(url); > } > return DriverManager.getConnection(url, username, password); > } > > Personally I use hibernate with spring or guice to deal with all that > connection junk these days. > > > gbattine wrote: >> >> Hello guys, >> I'm newbie about Struts and I'm trying to understand a complex task (for >> me), that is obtaining a connection from connection pool (I use dbcp for >> this) and a datasource (that one of tomcat) and use this connection in dao >> layer. >> I'm trying to get this working, but it seems very difficult to me. >> Could you help me? >> I show what I did: >> -I added context in server.xml of tomcat >> -I added declaration into web.xml of application, like this: >> <resource-ref> >> <description>DB Connection</description> >> <res-ref-name>jdbc/TestDB</res-ref-name> >> <res-type>javax.sql.DataSource</res-type> >> <res-auth>Container</res-auth> >> </resource-ref> >> >> Now my first question. >> What's next step? Could you please post simple code and comment to >> understand? >> What I imagine is now to have something to retrieve a connection and pass >> it to dao. >> Could you help me? >> >> Thanks very much >> >> >> > > -- > View this message in context: > http://www.nabble.com/connection-to-db-with-pooling-in-Struts-tp20738163p20767037.html > Sent from the Struts - User mailing list archive at Nabble.com. > > > --------------------------------------------------------------------- > 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]