This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes JDBC and the fly likes jdbc cancel query Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "jdbc cancel query" Watch "jdbc cancel query" New topic

jdbc cancel query

Selvan tiru

Joined: Jul 12, 2001
Posts: 18
Hello :
is there a way to cancel a SQL query that takes long time to get the results
set in JDBC. Basically once a query is submitted
a prorgess bar or progress moniter should
display,which gives the user a chance to cancel.
Once cancelled the program control comes back
Any ideas, suggestion
Ranch Hand

Joined: Jul 06, 2001
Posts: 54
Hi Selvan tiru,
If you had taken a look to the Statement Interface methods, you would have found that the method cancel(), answers exactly your question. This method assumes that both the driver and the database server support this operation.
Now if you are using a stored procedure to execute your query, you can still use the cancel() method since the CallableStatement and the PreparedStatement are both derived from the Statement Interface.
[This message has been edited by Omar IRAQI (edited July 12, 2001).]

Omar IRAQI Houssaini
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
subject: jdbc cancel query
Similar Threads
JTable linked to a query[jdbc], may used and in Applets
Killing a thread waiting for db query execution
JDBC doesn't retrieve all the results available in the MSSQL database
help in my first DBCP
Cancel database query....