Dear All,
I am developing an application on resin-2.1.9 web server.
Connection to MYSQL Database is using JNDI. JNDI connection code is written in a class
called DBService.
I am instantiating DBService class where ever i need database connection and getting
connection using getConnection() method.
when user start working on application, i m getting following errors,
Class:DBService. Method:getConnection() cann't open connection with full database
pool(30)
Class:MonthReport. Method:SelectReportDetailNull() cann't open connection with full
database pool(30)
it sounds like database pool is full, Whether i need to increase the pool size or
optimize code in DBService database connection class.
for your reference below code performs database connection.
--------------------------------------------------------------
public Connection getConnection()
{
java.sql.Connection con = null;
javax.sql.DataSource ds=null;
try{
Context initCtx = new InitialContext();
Context envCtx = (Context) initCtx.lookup("java:comp/env");
ds= (DataSource)envCtx.lookup("jdbc/training");
con = ds.getConnection();
}catch(Exception e){
System.out.println("Class : DBService, Method :
getConnection()"+e.getMessage());
}
return con;
}//end of getConnection method
-------------------------------------------------------------------------
Your advice will be great help to optimize my application.
Thanks in advance.
Regards,
Viru