Encountering "SQLServerException: The statement is closed." after update of JBoss EAP and/or update of the Microsoft SQL Server JDBC driver
Issue
- JBoss is configured with
prepared-statement-cache-size
> 0 (i.e. to enable pool-managed prepared statement caching) -
When a prepared statement is used a second time (after having previously been used in a different transaction or request context), the Microsoft SQL Server driver raises the exception below
... com.microsoft.sqlserver.jdbc.SQLServerException: The statement is closed. at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDriverError(SQLServerException.java:234) at com.microsoft.sqlserver.jdbc.SQLServerStatement.checkClosed(SQLServerStatement.java:1065)
- Issue encountered after update to later JBoss EAP 7.3 / 7.4 patch level OR update to SQL Server JDK 11 driver (from JDK 8 or earlier)
- The issue did not occur with older JBoss EAP 7.3.7 or earlier nor with the 7.4 GA.
- The issue did not occur with SQL Server JDK 8 driver versions.
Environment
- Red Hat JBoss Enterprise Application Platform (EAP)
- 7.3.8 or later
- 7.4.1 or later
- Microsoft SQL Server driver built for JDK 9 or later
- JDK 11
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.