This week's giveaway is in the Spring forum.
We're giving away four copies of REST with Spring (video course) and have Eugen Paraschiv on-line!
See this thread for details.
The moose likes JDBC and Relational Databases and the fly likes executing an update sql takes too long , what is problem ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "executing an update sql takes too long , what is problem ?" Watch "executing an update sql takes too long , what is problem ?" New topic

executing an update sql takes too long , what is problem ?

raminaa niilian
Ranch Hand

Joined: Jul 14, 2005
Posts: 551
Thank you for reading my post
My problem is :
Im trying to execute an update statement over a table in Derby database.
when i call executeUpdate()
it goes away and die (no exception , no data update happens)
I tried and used same query string (changed to fit the insert operation)
to insert data into database and it inserted successfylly.

I used Datasource , and PreparedStatement for updating , am i correct ?

and other parameter are set as the above.

when i execute the statement with executeUpdate() it dies

is there any method that i can see what is the sql string that the prepared statement is executing ?

thank you
Jeanne Boyarsky
author & internet detective

Joined: May 26, 2003
Posts: 32819

It is possible that some other process has a lock on the row you are trying to update. You are correct in using DataSource and PreparedStatement.

In your example, you only show the setting of one parmeter. In you real code, I assume you set all 4. Otherwise, the code would throw an exception. Also note that it is unnecessary to set EMPNO in the update query since that is what you are searching on and it isn't changing.

For testing, you could just write the query without any "?" so you know what is being executed. Or you could use a DebuggableStatement (search this forum for details.) I think that may be overkill here though.
Yilmaz Mete

Joined: Dec 23, 2003
Posts: 28
My experience:


ii) Are there any
Indexes or such constraints on the table to be updated?

I agree. Here's the link:
subject: executing an update sql takes too long , what is problem ?
It's not a secret anymore!