8 messages in com.mysql.lists.javaRe: how to cancel running queries?| From | Sent On | Attachments |
|---|---|---|
| Tilmann Singer | 14 Aug 1999 17:08 | |
| Mark Matthews | 15 Aug 1999 11:02 | |
| Tilmann Singer | 15 Aug 1999 13:02 | |
| Michael Widenius | 19 Aug 1999 22:52 | |
| Mark Matthews | 21 Aug 1999 20:13 | |
| Cris Perdue | 22 Aug 1999 11:02 | |
| Mark Matthews | 23 Aug 1999 04:58 | |
| Michael Widenius | 26 Aug 1999 04:02 |
| Subject: | Re: how to cancel running queries?![]() |
|---|---|
| From: | Mark Matthews (mmat...@worldserver.com) |
| Date: | 08/23/1999 04:58:02 AM |
| List: | com.mysql.lists.java |
On Sun, 22 Aug 1999, Cris Perdue wrote:
Hi Mark and all,
Mark Matthews wrote:
Unfortunately this breaks the semantics of the JDBC api. Canceling a statement should have no effect on the other open statements and/or open result sets, etc. So, therefore closing the connection won't really work in this case.
I have wondered sometimes whether an effective implementation of JDBC for MySQL might map JDBC Statements to MySQL connections and JDBC Connections to sets of MySQL connections.
Of course, this model would make it more important for applications to carefully manage the number of open Statements, and it would generally the costs of some operations. It would appear to be a possible implementation choice, though, particularly since MySQL does not have transactions with rollback/commit, which are bound to connections in JDBC.
Such a JDBC driver could cancel a running query by closing the MySQL ResultSet or Statement.
Mark, are you aware of other issues with such a design?
If you wrote an application that used a fair number of Connections, each with many statements (i.e. an Application Server), you stand the potential for running out of file descriptors, either on the client or on the server. For many Unices, this limit is around 256 file descriptors per process, so with an app server, you're looking at all of the network connections for distributed computing (RMI, Corba, et. al.), plus one connection for every JDBC statement you have open. Thus, file descriptors are a precious resource in this sort of application, so minimizing their use is paramount.
Also, if you are using JDBC to provide access to thin clients, you run into the same problem, but mostly on the server side.
After looking into some more particulars, it looks as though with a little re-writing MM.MySQL could support canceling statements by dropping the connection. I just feel it would be more proper, and perhaps useful to other APIs if MySQL supported a cancel command while reading rows from the server.
-Mark




