Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
Win a copy of Learning OpenStack Networking: Build a solid foundation in virtual networking technologies for OpenStack-based clouds this week in the Cloud/Virtualization forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

Number of connections grows forever  RSS feed

 
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
 
Author and ninkuma
Marshal
Posts: 66801
168
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
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!