• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Long time running quries time out

 
Ram cherla
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello All,
I am trying to cancel long time running database quries. I was using statment.setQuertTimeOut(seconds). But it was not working. I am thinking may be it is driver issue. If my current driver is not support this functionality, how to achive this statement qurey time out. could you please help me on this.
Thank you,
Ram Cherla
 
Shailesh Chandra
Ranch Hand
Posts: 1082
Java Oracle Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ram,

Which database are you using ?
What is execution time of query at database client like sqlplus or toad etc ?
how many records are fetched when you execute query ?

might be setQueryTimeout is working and bottleneck is somewhere else.

As per javadoc


public void setQueryTimeout(int seconds) throws SQLException

Sets the number of seconds the driver will wait for a Statement object to execute to the given number of seconds. If the limit is exceeded, an SQLException is thrown.



and query executions takes milliseconds if database is properly indexed.
 
Ram cherla
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Shailesh,
Thanks, We are using DB2 UDB, and i am using DB2 client(command center)to query the database. From client that query takes more than 10 mins, and gives me couple of hundred thousand records. Could you please explain me, what are bottleneck you think here.
Thanks again,
Ram
 
Shailesh Chandra
Ranch Hand
Posts: 1082
Java Oracle Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ram,

if query is taking 10 minute to execute then problem is at you database side only.

In any case you need to tune your query.

Is there any index on table ?

please paste your query here so that any suggestion can be given !

thanks
[ March 13, 2005: Message edited by: Shailesh Chandra ]
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic