SQL Server JDBC Object has been closed

We have been running into a difficult exception while using the MS SQL Server JDBC driver and the execSQL service. It appears that there may be some thread safety and/or other incompatibilities with this driver, execSQL, and/or the connection pool.

The exception thrown by the JDBC driver is called “Object has been closed”. This exception means that something, or some thread has “closed” the object before it finished. This error occurs often but is very difficult to reproduce in a development environment. We notice it on a number of different calling services that are running concurrently (e.g. 2 different services may be calling the same execSQL at the same time). Again, it is not easy to reproduce. I scheduled 3 different services to run every second on the development server. These services all wind up calling the same execSQL. After about 20 mins I managed to create one “closed socket” exception … after about 4 hours … I managed to create a few of the “Object has been closed” exceptions.

Has anyone run into something similar? TIA for replies.


We had major issues with the execSQL service - but it was only occurring with long running scheduled services as you have indicated you are also using. The solution proposed by wm support was to wrap the scheduled service call in a java service that reconnects to the server (using the Context class) so that each scheduled service gets its own session rather than them sharing sessions.
It seemed to work but we ended up moving our db calls to EJBs.
So have your scheduled service call a java service which connects to the server and invokes the flow you want to invoke.

So basically loopback to the server?

Why couldn’t this be done with an HTTP call and a flow? I’m not sure why I would need to use Java to make this happen.

Thanks again for the reply.

You always have the option for wm clients of using the java api or http. Feel free to use either one.

We just confirmed that this error appears to happen even when we are only running one process on the server.

I am wondering what the BC (WM server) would use for connection pooling. I have found several references to indicate that the MSSQL driver is incompatible with certain connection pooling implementations. In the case that it is incompatible, it can throw up this error.