0

We've been trying to figure out a way to run a very long running (3-4 hours) stored procedure remotely using either Sybase's isql client or Java. The stored procedure starts fine and even runs and returns some print output. But then hits this very large select * into #tmp .... statement that takes over 3 hours to run. But somewhere after about 2 hours, the network connection is dropped...most likely due to in-activity as no print output comes back from the stored procedure and the isql client is not sending any requests.

Background : When we run this stored procedure remotely from a Linux batch server using the isql command line client, it starts, but then because of the length of time (3-4 hours), something in our network layers simply drops the connection and the Sybase server never responds back to the client. Same issue when we try and run the stored procedure using a GUI client like DBVisualizer on our laptops...remote execution starts, runs, but never responds. Basically, any attempt to run the stored procedure remotely fails.

Non-network : However, when we run the stored procedure ON the actual Sybase Unix server (I.e. the Sybase database and the isql client are on the same Unix server) using the isql client it DOES finish. So, when running the stored procedure in a "local" non-remote situation it finishes fine.

Conclusion : That something in the network layers simply drops the connection because of in-activity.

That said, We have tried the following without success :

  • a.) Changed the Linux tcp_keepalive to 4 hours on the batch server.
  • b.) Changed the Unix/AIX tcp_keepidle to 4 hours on the Sybase server.
  • c.) Wrote a custom Java multi-thread process that created 2 threaded SQL calls, one for the Stored Procedure, one for a simple "keep-alive" select. But once the stored proc starts running it locks/blocks out the other thread. This appears to be a sympthom of the Sybase JDBC Drivers, they simply do NOT allow 2 SQL statements to run in parallel... Concurrent use of same JDBC connection by multiple threads and Is asynchronous jdbc call possible?.

My question is, is there any other options I've over-looked? We've been told by our Database admins that the Sybase engine has no limitations or timeouts set, but is there anyway to confirm this? We are currently checking our firewalls, but i'm skeptical that a firewall maintains a "session"...although I'm not a firewall expert. Again, is there anyway to test a firewall timeout?

tia, adym

UPDATE : 09/11/2017 -

I set the DEFAULT_QUERY_TIMEOUT to 8 hours (I think). From what I read, you provide this in seconds. But this made no difference.

        Properties props = new Properties();
        props.put   ( "user",                   getJDBCUsername()               );
        props.put   ( "password",               getJDBCPassword(isEncrypted())  );
        props.put   ( "DEFAULT_QUERY_TIMEOUT",  28800                           );
        this.connection = DriverManager.getConnection ( getJDBCUrl (),  props );
lincolnadym
  • 909
  • 1
  • 12
  • 29
  • You have said that you have tried to run the stored procedure remotely and it does not work. But localy - it works. Then it is network issue. Local connection also uses TCP. If there is a firewall between then it is probably causing the connection to break. – Adam Leszczyński Sep 08 '17 at 18:28
  • the comment about disconnecting after `about 2 hours` sounds like a tcp keepalive issue as 2 hours is the typical default setting; unfortunately `isql` does not appear to have any sort of `keepalive` setting of its own, and I'm not (at the moment) coming up with any ideas on how to get a long-running query to periodically output a (status) message that could force a reset of the keepalive counter – markp-fuso Sep 08 '17 at 18:28
  • I would also recommend you get your system and network admins involved; have them check the keepalive settings along the path from your host to the database host ... this could be as 'simple' as bumping up the keepalive settings for a host, router or firewall – markp-fuso Sep 08 '17 at 18:43
  • Keepalive interval should be reduced to 1-10 minutes. But it won't help, unless the programs in question actually enable keepalive. (In Oracle, there is a description=(enable=broken) option in tnsnames.ora for this.) – Zsigmond Lőrinczy Sep 09 '17 at 05:23

0 Answers0