473,326 Members | 2,655 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

interupt JDBC SQL query connection

Hi

I using Java and JDBC to connect to MS SQL server 2000 (using the MS
drivers msbase,msutil and mssqlserver.jars).

Sometimes it takes a long time for statement.executeQuery
to return and start returning the resultset
(full DB scan can take 30-40 minutes).

Does anyone know if it's possible to interupt/halt the query before
it eventually comes back. The setQueryTimeout works OK but this has to be
set quite high to allow real queries to run correctly. What I'm trying
to do is allow users to halt their query if they've realised they
want to alter it or its taking too long. The query is running in a
separate thread and I've tried using the main thread to close the
connection or stop the query but this still waits until the resultset
is returned.

Maybe it's a driver issue or .....

Thanks
Mike
Jul 17 '05 #1
4 4545
Hi

I am not sure about the JDBC driver itself, but you could use a timer thread
to kill it off.

John

"Mike Read" <ma*@roe.ac.uk> wrote in message
news:Pi********************************@reaxp06.ro e.ac.uk...
Hi

I using Java and JDBC to connect to MS SQL server 2000 (using the MS
drivers msbase,msutil and mssqlserver.jars).

Sometimes it takes a long time for statement.executeQuery
to return and start returning the resultset
(full DB scan can take 30-40 minutes).

Does anyone know if it's possible to interupt/halt the query before
it eventually comes back. The setQueryTimeout works OK but this has to be
set quite high to allow real queries to run correctly. What I'm trying
to do is allow users to halt their query if they've realised they
want to alter it or its taking too long. The query is running in a
separate thread and I've tried using the main thread to close the
connection or stop the query but this still waits until the resultset
is returned.

Maybe it's a driver issue or .....

Thanks
Mike

Jul 17 '05 #2
how many people here get the luxery of creating and maintaining apps in
jbuilder and together everyday? care to share any stories, either great
or not so great! i just got an eval of the latest and greatest installed
and after using previous versions for years, what i see now looks really
great. just was wondering about your experiences.

cheers

- perry

Jul 17 '05 #3
I'm just new in the Java World and also JBuilder X Enterprise IDE. I'm
making a servlet client , using Struts , because the MVC pattern is just what
we need for our application.
Until now this is working just fine. I like the IDE, autocompletion, colors,
indent, etc.
The progam gives a lots of tips and help using class, packages, etc.

Greetings.....

In comp.lang.java perry <pe***@cplusplus.org> wrote:
: how many people here get the luxery of creating and maintaining apps in
: jbuilder and together everyday? care to share any stories, either great
: or not so great! i just got an eval of the latest and greatest installed
: and after using previous versions for years, what i see now looks really
: great. just was wondering about your experiences.

: cheers

: - perry
--
Alfredo Diaz
================
School of Engineering and Science, University of Chile
Beaucheff 850, P.O. Box 2777, Santiago, CHILE
mailto:aa****@dcc.uchile.cl.nospam
Jul 17 '05 #4
Mike Read (ma*@roe.ac.uk) writes:
I using Java and JDBC to connect to MS SQL server 2000 (using the MS
drivers msbase,msutil and mssqlserver.jars).

Sometimes it takes a long time for statement.executeQuery
to return and start returning the resultset
(full DB scan can take 30-40 minutes).

Does anyone know if it's possible to interupt/halt the query before
it eventually comes back. The setQueryTimeout works OK but this has to be
set quite high to allow real queries to run correctly. What I'm trying
to do is allow users to halt their query if they've realised they
want to alter it or its taking too long. The query is running in a
separate thread and I've tried using the main thread to close the
connection or stop the query but this still waits until the resultset
is returned.


You will have to examine the documetation for the JDBC driver. Most
client APIs for SQL Server supplies functions for asynchronous calls.
With a asynch call, you could then issue a cancel request (again this
is offered by most client APIs).

microsoft.public.sqlserver.jdbcdriver may offer more exact answers with
regards to that driver.
--
Erland Sommarskog, SQL Server MVP, es****@sommarskog.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinf...2000/books.asp
Jul 17 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Riccardo | last post by:
Hi, This jsp code doesn't run. Why ? ----------------------------------------------------------- <%@ page import="java.sql.*" %> <%! String Query(String SQL, String DSN) {
0
by: sridhar nagabhurshana | last post by:
hello I am trying to connect to mysql database using connector/J jdbc driver this is my code import java.sql.Connection; import java.sql.DriverManager; import java.sql.SQLException;
4
by: Mike Read | last post by:
Hi I using Java and JDBC to connect to MS SQL server 2000 (using the MS drivers msbase,msutil and mssqlserver.jars). Sometimes it takes a long time for statement.executeQuery to return and...
6
by: Swami | last post by:
Hi, I have installed MQ SQL Server 2000 on my laptop and trying to use SPRINTA 2000 JDBC Driver (inetmssql.jar) to connect to the local db. I wrote a sample Java app to test the connection and I...
1
by: Andrea | last post by:
Hello, I spent now several hours searching the google groups without finding an solution. I am kind of Newbie to DB2 and JSP and therefore working with JSP4Dummies (not sure whether I should...
4
by: Ying Lu | last post by:
Hello, Under mysql, we have "desc tablename" to get the detail information about a table. My question is about to get column name, and column type for a specific table under PostgreSQL through...
1
by: kommaraju | last post by:
iam a starter to db2 & jdbc.i have a servlet program which connects to ibm db2 using jdbc.when i run this using apache tomcat 4.1.34 , it is showing a error message of HTTP STATUS 500 my jdbc...
2
by: bevis | last post by:
I'm new to sql server and mysql but this seems like it should be a pretty straight forward jdbc connection. But I have spent almost 2 days just trying to get a jdbc connection. Please help if you...
1
by: rjha94 | last post by:
Hi Folks we have a java application using hibernate ORM mapper on top of db2 UDB v9. we are using type 4 jdbc drivers for connections. Now the issue is we have a table with BLOB column and ...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.