How to handle JDBC SQL Server, Sybase for long running and high memory consumption process
How to handle JDBC SQL Server, Sybase for long running and high memory consumption process
I have a batch job querying Sybase and SQL Server databases. This batch job can run for up to 1 day or more. We are running this on a small set of data and no error so far in terms of connection timeout. My questions are
How to handle this long running process? Should I configure a reconnect period so that the connection gets closed and reopened?
How to handle the resultset when it can return back to the client with 1 million records?
EDIT #1:
This sounds like a general question for jdbc but it's not because each database provider has their own options such as fetching size. It's very much up to each provider to support this or not. If Sybase does not support this, it means it will load all results into memory at once.
1 Answer
1
This is a general question not strictly related to Sybase (SAP) ASE.
If you want the tcp/ip connection not to break then use some keep alive parameters for network connections. If you want to handle network connection breaks then use some connection polling libraries.
You don't have to store the whole result set in your memory. Just read your rows and process them on the fly. If you do want to fetch all 1 million rows before before doing anything with them - then just more memory to the JVM.
Please add an example query that you are using and is grabbing into memory immediately all 1M rows at once. Normal iteration through resultset should not do that.
– Adam Leszczyński
yesterday
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.
it's related Adam. I saw other databases like Oracle they have streaming options. But haven't seen this with Sybase
– TrongBang
2 days ago