com.microsoft.sqlserver.jdbc.SQLServerException: The statement is closed.

Hibernate JIRA | Szczepan Kuzniarz | 3 years ago
tip
Your exception is missing from the Samebug knowledge base.
Here are the best solutions we found on the Internet.
Click on the to mark the helpful solution and get rewards for you help.
  1. 0

    {{NonBatchingBatch}} in {{addToBatch()}} method calls {{jdbcCoordinator.release(Statement))}} for every statement, and then calls {{releaseStatements}} method which calls {jrelease}} again. It causes an exception in {{JdbcCoordinatorImpl.close(Statement)}}, and although the exception is caught it causes early exit and I think should be avoided. {code} com.microsoft.sqlserver.jdbc.SQLServerException: The statement is closed. at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDriverError(SQLServerException.java:190) at com.microsoft.sqlserver.jdbc.SQLServerStatement.checkClosed(SQLServerStatement.java:980) at com.microsoft.sqlserver.jdbc.SQLServerStatement.getMaxRows(SQLServerStatement.java:1011) at net.sf.log4jdbc.StatementSpy.getMaxRows(StatementSpy.java:949) at org.hibernate.engine.jdbc.internal.JdbcCoordinatorImpl.close(JdbcCoordinatorImpl.java:530) at org.hibernate.engine.jdbc.internal.JdbcCoordinatorImpl.release(JdbcCoordinatorImpl.java:407) at org.hibernate.engine.jdbc.batch.internal.AbstractBatchImpl.releaseStatements(AbstractBatchImpl.java:173) at org.hibernate.engine.jdbc.batch.internal.NonBatchingBatch.addToBatch(NonBatchingBatch.java:76) at org.hibernate.persister.entity.AbstractEntityPersister.update(AbstractEntityPersister.java:3281) at org.hibernate.persister.entity.AbstractEntityPersister.updateOrInsert(AbstractEntityPersister.java:3183) at org.hibernate.persister.entity.AbstractEntityPersister.update(AbstractEntityPersister.java:3525) at org.hibernate.action.internal.EntityUpdateAction.execute(EntityUpdateAction.java:158) at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:453) at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:345) at org.hibernate.event.internal.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:350) at org.hibernate.event.internal.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:56) at org.hibernate.internal.SessionImpl.flush(SessionImpl.java:1218) {code}

    Hibernate JIRA | 3 years ago | Szczepan Kuzniarz
    com.microsoft.sqlserver.jdbc.SQLServerException: The statement is closed.
  2. 0

    {{NonBatchingBatch}} in {{addToBatch()}} method calls {{jdbcCoordinator.release(Statement))}} for every statement, and then calls {{releaseStatements}} method which calls {jrelease}} again. It causes an exception in {{JdbcCoordinatorImpl.close(Statement)}}, and although the exception is caught it causes early exit and I think should be avoided. {code} com.microsoft.sqlserver.jdbc.SQLServerException: The statement is closed. at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDriverError(SQLServerException.java:190) at com.microsoft.sqlserver.jdbc.SQLServerStatement.checkClosed(SQLServerStatement.java:980) at com.microsoft.sqlserver.jdbc.SQLServerStatement.getMaxRows(SQLServerStatement.java:1011) at net.sf.log4jdbc.StatementSpy.getMaxRows(StatementSpy.java:949) at org.hibernate.engine.jdbc.internal.JdbcCoordinatorImpl.close(JdbcCoordinatorImpl.java:530) at org.hibernate.engine.jdbc.internal.JdbcCoordinatorImpl.release(JdbcCoordinatorImpl.java:407) at org.hibernate.engine.jdbc.batch.internal.AbstractBatchImpl.releaseStatements(AbstractBatchImpl.java:173) at org.hibernate.engine.jdbc.batch.internal.NonBatchingBatch.addToBatch(NonBatchingBatch.java:76) at org.hibernate.persister.entity.AbstractEntityPersister.update(AbstractEntityPersister.java:3281) at org.hibernate.persister.entity.AbstractEntityPersister.updateOrInsert(AbstractEntityPersister.java:3183) at org.hibernate.persister.entity.AbstractEntityPersister.update(AbstractEntityPersister.java:3525) at org.hibernate.action.internal.EntityUpdateAction.execute(EntityUpdateAction.java:158) at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:453) at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:345) at org.hibernate.event.internal.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:350) at org.hibernate.event.internal.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:56) at org.hibernate.internal.SessionImpl.flush(SessionImpl.java:1218) {code}

    Hibernate JIRA | 3 years ago | Szczepan Kuzniarz
    com.microsoft.sqlserver.jdbc.SQLServerException: The statement is closed.
  3. 0

    JDBC to SQL Azure Best Practices?

    microsoft.com | 1 year ago
    com.microsoft.sqlserver.jdbc.SQLServerException: The connection is closed.
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    RE: [dbcp] Re: "Connection reset" exceptions

    apache.org | 1 year ago
    com.microsoft.sqlserver.jdbc.SQLServerException: The connection is closed.
  6. 0

    Microsoft SQL Driver throws SQLServerException: The connection is closed. - Red Hat Customer Portal

    redhat.com | 12 months ago
    com.microsoft.sqlserver.jdbc.SQLServerException: The connection is closed.

    1 unregistered visitors
    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. com.microsoft.sqlserver.jdbc.SQLServerException

      The statement is closed.

      at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDriverError()
    2. com.microsoft.sqlserver
      SQLServerStatement.getMaxRows
      1. com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDriverError(SQLServerException.java:190)
      2. com.microsoft.sqlserver.jdbc.SQLServerStatement.checkClosed(SQLServerStatement.java:980)
      3. com.microsoft.sqlserver.jdbc.SQLServerStatement.getMaxRows(SQLServerStatement.java:1011)
      3 frames
    3. log4jdbc-log4j2-jdbc4
      StatementSpy.getMaxRows
      1. net.sf.log4jdbc.StatementSpy.getMaxRows(StatementSpy.java:949)
      1 frame
    4. Hibernate
      SessionImpl.flush
      1. org.hibernate.engine.jdbc.internal.JdbcCoordinatorImpl.close(JdbcCoordinatorImpl.java:530)
      2. org.hibernate.engine.jdbc.internal.JdbcCoordinatorImpl.release(JdbcCoordinatorImpl.java:407)
      3. org.hibernate.engine.jdbc.batch.internal.AbstractBatchImpl.releaseStatements(AbstractBatchImpl.java:173)
      4. org.hibernate.engine.jdbc.batch.internal.NonBatchingBatch.addToBatch(NonBatchingBatch.java:76)
      5. org.hibernate.persister.entity.AbstractEntityPersister.update(AbstractEntityPersister.java:3281)
      6. org.hibernate.persister.entity.AbstractEntityPersister.updateOrInsert(AbstractEntityPersister.java:3183)
      7. org.hibernate.persister.entity.AbstractEntityPersister.update(AbstractEntityPersister.java:3525)
      8. org.hibernate.action.internal.EntityUpdateAction.execute(EntityUpdateAction.java:158)
      9. org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:453)
      10. org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:345)
      11. org.hibernate.event.internal.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:350)
      12. org.hibernate.event.internal.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:56)
      13. org.hibernate.internal.SessionImpl.flush(SessionImpl.java:1218)
      13 frames