Hi i am new to struts, I want to use JNDI with DBCP.Is it Possiable? For DBCP i have use Struts-config Q1) Where to configure for JNDI? Q2) What are advantages and disadvantages of using DBCP? Q3) Which is best approach either to write ConnectionPool classes or use DBCP?( i have mentioned code below)
Q3) Which is best approach either to write ConnectionPool classes or use DBCP?
The Struts DBCP datasource configuration utility has been deprecated. It's no longer supported in Version 1.3.5 and above. I would strongly recommend that you not use it.
There's no need to "roll your own" connection pooling utility either. Any Application Server worth using has its own connection pooling configuration utility. They have put a lot of time and effort into making it work efficiently with that specific App server, so why not use it?
The best practice for JDBC DataSources in a J2EE application is to use your App server's configuration utility to set up a DataSource and store a reference to it in JNDI. In your application code you simply look up the reference in JNDI and use the retrieved DataSource to get a JDBC Connection.