Search code examples
sql-serverjdbcjasper-reportsclarity

How can I solve socket closed when report takes long-time to run?


I am running reports in Clarity made with iReport.

One of my reports is quite complex and sometimes takes a long time to run (depending on parameters). Sometimes, it takes too long and I get a message that says

Socket Closed

This message does not appear when the report runs quickly. I would assume that this means that the run has timed-out. I am currently working to make the SQL run faster, but I fear it will still not be before the time-out.

Is there anyway to make the socket stay open longer?

screenshot of error message


Solution

  • You can put additional parameters into the connection string, e.g.

    jdbc:jtds:sqlserver://server:port/database;socketTimeout=120
    

    This should only be used as a last resort, though. Maybe bad infrastructure or a too complex query with not enough indices is the real reason for a slow running query.