Results 1 to 3 of 3
Thread: Oracle Resultset slow
- 06-28-2007, 01:44 PM #1
Senior Member
- Join Date
- Jun 2007
- Posts
- 119
- Rep Power
- 0
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
Java 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); } //forLast edited by Peter; 07-04-2007 at 01:53 PM.
- 07-04-2007, 01:54 PM #2
Senior Member
- Join Date
- Jun 2007
- Posts
- 164
- Rep Power
- 6
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.
- 07-04-2007, 01:56 PM #3
Senior Member
- Join Date
- Jun 2007
- Posts
- 110
- Rep Power
- 0
Similar Threads
-
slow JasperReport
By bbq in forum Advanced JavaReplies: 3Last Post: 02-11-2008, 08:34 AM -
eclipse very slow
By katie in forum EclipseReplies: 2Last Post: 11-05-2007, 10:20 AM -
PredifinedStatment is too slow for me?
By liorb in forum JDBCReplies: 1Last Post: 07-31-2007, 04:53 PM -
Export query result, procces is to slow
By Daniel in forum Enterprise JavaBeans (EJB)Replies: 2Last Post: 06-28-2007, 06:35 PM -
Slow reports in Netbeans
By Alan in forum NetBeansReplies: 1Last Post: 05-29-2007, 03:47 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks