Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Number of connections grows forever  RSS feed

 
Giuseppe Italiano
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a web application based on MySQL Database.
It works fine but sometines I receive an error message that said me that I have overlapped connection number limit.
I try to close it but it doesn't work.
This is an example of code of my DataAccessObject:
...............
public void insertRow(String PBS,String lev1,String lev2,
String lev3,String lev4) {
Collection results = new ArrayList();
final String INSERT_ROW= "INSERT INTO " +ini.FilePBS()+
" (PBS,NOMELEV1,NOMELEV2,NOMELEV3,NOMELEV4,BUDGETJR,BUDGETSR,BUDGETMG,"+
"ENDEXMJR,ENDEXMSR,ENDEXMMG) "+
"values('"+PBS+"','"+lev1+"','"+lev2+"','"+lev3+"','"+lev4+
"','0','0','0','0','0','0')";
Connection con = _connectionPool.getConnection();
try{
Statement stmt = con.createStatement();
stmt.executeUpdate(INSERT_ROW);
System.out.println(INSERT_ROW);
stmt.close();
_connectionPool.closeConnection(con);
con.close();
}
catch(SQLException ex){
System.out.println(ex);
}
finally{
try{
Statement stmt=con.createStatement();
stmt.close();
con.close();}
catch(SQLException ex2){
System.out.println(ex2);
}
}
}
...........
bye
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65825
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch Giuseppe!
You'll find this forum a great place to seek help on JSP pages, and there aren't many rules you'll have to worry about, but one is that proper names are required. Please take a look at the JavaRanch Naming Policy and change your display name to match it.
Additionally, your code will be much easier to read if you enclose it with the UBB code tags -- that way, your formatting will be preserved making it much easier for people to look through and answer your question.
Thanks and welcome!
bear
JSP Fourm Bartender
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!