• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Number of connections grows forever

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic