JDBC Cancel request

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

JDBC Cancel request

Stefan.Marquardt
Hello,

When I run a long query with aggregation cancel isn’t possible.
The message is: not supported.

It seems to be that it has to be called on another way because the manufacturer (Progress/OpenEdge) provided a KB:

----------------------------------------------------------------------------

The client code is written in Java.
The Connection object's abort() method is not supported.

Assume an SQL query is initiated from Java. 
The Java code might look like the following:

Assume a Connection object, connected to the database, exists. The instantiated Connection object is called myConnection.
Assume the query is against the sports2000 database and the Customer table within the sports2000 database.

Statement myStatement = null;
String myQuery = "select * from PUB.Customer";

try {
        myStatement =   myConnection.createStatement().
        ResultSet myRs = myStatement.executeQuery(myQuery );
        /* The remainder of the try block processes what is returned by the SQL query. */
      } CATCH {SQLException e) {
        /* exception handling code */
      } finally {
          if (myStatement  != null) { myStatement.close();}
      }



 

Error Message


Defect/Enhancement Number

Cause



Resolution
In a separate thread, call the Statement object's cancel() method. The Statement object created in the thread that initiated the query must be passed to the separate thread that cancels the query. Assume myStatement is the Statement object. The separate thread should have a timeout associated with it to ensure it exits should the attempt to cancel the SQL query fail.

A call to the Statement object's cancel method looks like the following:

if (myStatement != null && !myStatement.isClosed())
{  
    myStatement.cancel();
}

-------------------------------------------------------------------------------------------------



Kind regards

Stefan Marquardt, Information Technology, IT Domain Direct | Hannover Re, Karl-Wiechert-Allee 50, 30625 Hannover, Germany | phone +49 511 5604 2799, mob +49 172 7292066, fax +49 511 5604 4799, [hidden email] |  www.hannover-re.com


==================================
Hannover Rück SE, Handelsregister (Commercial Register) Hannover HRB 6778 / E+S Rückversicherung AG, Handelsregister (Commercial Register) Hannover HRB 6117; für beide Gesellschaften gilt (applicable to both companies): Karl-Wiechert-Allee 50, 30625 Hannover, Germany; Sitz (registered office) der Gesellschaften: Hannover; Aufsichtsrat (Supervisory Board): Herbert K. Haas (Vorsitzender/Chairman); Vorstand (Executive Board): Ulrich Wallin (Vorsitzender/Chairman), Sven Althoff*, Claude Chèvre*, Jürgen Gräber*, Dr. Klaus Miller, Dr. Michael Pickel, Roland Vogel (*nur Mitglied des Vorstands der Hannover Rück SE/member of the Hannover Rück SE Executive Board only)

------------------------------------------------------------------------------
Developer Access Program for Intel Xeon Phi Processors
Access to Intel Xeon Phi processor-based developer platforms.
With one year of Intel Parallel Studio XE.
Training and support from Colfax.
Order your platform today. http://sdm.link/xeonphi
_______________________________________________
Squirrel-sql-develop mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/squirrel-sql-develop
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: JDBC Cancel request

Gerd Wagner-3
SQuirreL uses the mechanism you mention. Here is what it does in a bit
of detail:
1. Queries are executed in separate threads which prevents SQuirreL from
freezing and is needed to make the cancel button actually accessible.
2. When the cancel button is clicked another thread is started. In this
thread statement.cancel() is called. If this thread does not finish
within 1500 milli seconds a time out message is written to the message
panel. But even if after the time out statement.cancel() succeed or
fails an according message is written to the message panel.

The core of the implementation can bee seen here:
https://sourceforge.net/p/squirrel-sql/git/ci/master/tree/sql12/core/src/net/sourceforge/squirrel_sql/client/session/CancelStatementThread.java

So your problem I think should be different one. Could you please have a
look at the logs after the problem appeared an see if there is more
information. If so please post it.

Gerd


Am 01.11.2016 um 07:37 schrieb [hidden email]:

> Hello,
>
> When I run a long query with aggregation cancel isn’t possible.
> The message is: not supported.
>
> It seems to be that it has to be called on another way because the manufacturer (Progress/OpenEdge) provided a KB:
>
> ----------------------------------------------------------------------------
>
> The client code is written in Java.
> The Connection object's abort() method is not supported.
>
> Assume an SQL query is initiated from Java.
> The Java code might look like the following:
>
> Assume a Connection object, connected to the database, exists. The instantiated Connection object is called myConnection.
> Assume the query is against the sports2000 database and the Customer table within the sports2000 database.
>
> Statement myStatement = null;
> String myQuery = "select * from PUB.Customer";
>
> try {
>         myStatement =   myConnection.createStatement().
>         ResultSet myRs = myStatement.executeQuery(myQuery );
>         /* The remainder of the try block processes what is returned by the SQL query. */
>       } CATCH {SQLException e) {
>         /* exception handling code */
>       } finally {
>           if (myStatement  != null) { myStatement.close();}
>       }
>
> ​
>
>
>
> Error Message
>
>
> Defect/Enhancement Number
>
> Cause
>
>
>
> Resolution
> In a separate thread, call the Statement object's cancel() method. The Statement object created in the thread that initiated the query must be passed to the separate thread that cancels the query. Assume myStatement is the Statement object. The separate thread should have a timeout associated with it to ensure it exits should the attempt to cancel the SQL query fail.
>
> A call to the Statement object's cancel method looks like the following:
>
> if (myStatement != null && !myStatement.isClosed())
> {
>     myStatement.cancel();
> }
>
> -------------------------------------------------------------------------------------------------
>
>
>
> Kind regards
>
> Stefan Marquardt, Information Technology, IT Domain Direct | Hannover Re, Karl-Wiechert-Allee 50, 30625 Hannover, Germany | phone +49 511 5604 2799, mob +49 172 7292066, fax +49 511 5604 4799, [hidden email] |  www.hannover-re.com
>
>
> ==================================
> Hannover Rück SE, Handelsregister (Commercial Register) Hannover HRB 6778 / E+S Rückversicherung AG, Handelsregister (Commercial Register) Hannover HRB 6117; für beide Gesellschaften gilt (applicable to both companies): Karl-Wiechert-Allee 50, 30625 Hannover, Germany; Sitz (registered office) der Gesellschaften: Hannover; Aufsichtsrat (Supervisory Board): Herbert K. Haas (Vorsitzender/Chairman); Vorstand (Executive Board): Ulrich Wallin (Vorsitzender/Chairman), Sven Althoff*, Claude Chèvre*, Jürgen Gräber*, Dr. Klaus Miller, Dr. Michael Pickel, Roland Vogel (*nur Mitglied des Vorstands der Hannover Rück SE/member of the Hannover Rück SE Executive Board only)
>
>
>
> ------------------------------------------------------------------------------
> Developer Access Program for Intel Xeon Phi Processors
> Access to Intel Xeon Phi processor-based developer platforms.
> With one year of Intel Parallel Studio XE.
> Training and support from Colfax.
> Order your platform today. http://sdm.link/xeonphi
>
>
>
> _______________________________________________
> Squirrel-sql-develop mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/squirrel-sql-develop
>

------------------------------------------------------------------------------
Developer Access Program for Intel Xeon Phi Processors
Access to Intel Xeon Phi processor-based developer platforms.
With one year of Intel Parallel Studio XE.
Training and support from Colfax.
Order your platform today. http://sdm.link/xeonphi
_______________________________________________
Squirrel-sql-develop mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/squirrel-sql-develop
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: JDBC Cancel request

Stefan.Marquardt
Hello Gerd,

thank you for the info.
I forwarded it to the support of Progress, they managed to reproduce the issue and will discuss it with their development.


Stefan


-----Original Message-----
From: Gerd Wagner [mailto:[hidden email]]
Sent: Samstag, 5. November 2016 11:42
To: Marquardt Stefan; [hidden email]
Subject: Re: [Squirrel-sql-develop] JDBC Cancel request

SQuirreL uses the mechanism you mention. Here is what it does in a bit of detail:
1. Queries are executed in separate threads which prevents SQuirreL from freezing and is needed to make the cancel button actually accessible.
2. When the cancel button is clicked another thread is started. In this thread statement.cancel() is called. If this thread does not finish within 1500 milli seconds a time out message is written to the message panel. But even if after the time out statement.cancel() succeed or fails an according message is written to the message panel.

The core of the implementation can bee seen here:
https://sourceforge.net/p/squirrel-sql/git/ci/master/tree/sql12/core/src/net/sourceforge/squirrel_sql/client/session/CancelStatementThread.java

So your problem I think should be different one. Could you please have a look at the logs after the problem appeared an see if there is more information. If so please post it.

Gerd



==================================
Hannover Rück SE, Handelsregister (Commercial Register) Hannover HRB 6778 / E+S Rückversicherung AG, Handelsregister (Commercial Register) Hannover HRB 6117; für beide Gesellschaften gilt (applicable to both companies): Karl-Wiechert-Allee 50, 30625 Hannover, Germany; Sitz (registered office) der Gesellschaften: Hannover; Aufsichtsrat (Supervisory Board): Herbert K. Haas (Vorsitzender/Chairman); Vorstand (Executive Board): Ulrich Wallin (Vorsitzender/Chairman), Sven Althoff*, Claude Chèvre*, Jürgen Gräber*, Dr. Klaus Miller, Dr. Michael Pickel, Roland Vogel (*nur Mitglied des Vorstands der Hannover Rück SE/member of the Hannover Rück SE Executive Board only)
------------------------------------------------------------------------------
Developer Access Program for Intel Xeon Phi Processors
Access to Intel Xeon Phi processor-based developer platforms.
With one year of Intel Parallel Studio XE.
Training and support from Colfax.
Order your platform today. http://sdm.link/xeonphi
_______________________________________________
Squirrel-sql-develop mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/squirrel-sql-develop
Loading...