Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Linux Archive
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 06-28-2007, 03:44 PM
Senior Member
 
Join Date: Jun 2007
Posts: 119
Peter is on a distinguished road
Oracle Resultset slow
I have a problem with an Oracle Resultset using jdbc. It works about once a week when doing a simple
long value = results.getLong("value");
the process will hang and start spinning and use up about 75% of the CPU on the server. The only way to get it going again is to kill it and restart. As you can guess the other users aren't very happy when this happens.

what's the problem???
thanks
Code:
for(;;) { Statement mainStmt = connection.createStatement(); java.sql.ResultSet results = getData(mainStmt); if (results != null) { String message = null; try { while (results.next()) { message = null; //this is the statement that hangs. mod_date = results.getLong("modified_date"); try { message = createXMLString(results); publishMessage(message); } catch(Exception ex) { errorHandler(false, 0, procName, "Unable to create TextMessage for " + results.getString("ID") + ":" + ex.toString()); message = null; publishError = true; } } //while results.close(); results = null; mainStmt.close(); } catch (Exception ex) { errorHandler(false, 0, procName, "unknown error:" + ex.toString()); ex.printStackTrace(); } } rest(60); } //for

Last edited by Peter : 07-04-2007 at 03:53 PM.
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 07-04-2007, 03:54 PM
Senior Member
 
Join Date: Jun 2007
Posts: 164
Heather is on a distinguished road
When you are creating following object
Statement mainStmt = connection.createStatement();
java.sql.ResultSet results = getData(mainStmt);
in for loop will make the heap occupied with the objects. instead, place the same statements out side the for loop and also String message = null as well. Objects which are created in the loop, should be moved outside the loop, would solve your problem.
Bookmark Post in Technorati
Reply With Quote
  #3 (permalink)  
Old 07-04-2007, 03:56 PM
Ed Ed is offline
Senior Member
 
Join Date: Jun 2007
Posts: 110
Ed is on a distinguished road
Database object may not be closed properly, which is causing the pile up of objects in the heap
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
slow JasperReport bbq Advanced Java 3 02-11-2008 10:34 AM
eclipse very slow katie Eclipse 2 11-05-2007 12:20 PM
PredifinedStatment is too slow for me? liorb Database 1 07-31-2007 06:53 PM
Export query result, procces is to slow Daniel Enterprise JavaBeans 2 06-28-2007 08:35 PM
Slow reports in Netbeans Alan NetBeans 1 05-29-2007 05:47 PM


All times are GMT +3. The time now is 02:40 AM.


VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org