java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]The cursor was not declared.

There are no available Samebug tips for this exception. Do you have an idea how to solve this issue? A short tip would help users who saw this issue last week.

  • Webstart Issue
    via by 3004,
  • JDBC | SQL Server connection error
    via Stack Overflow by MMRUser
    ,
  • JDBC/DAO IllegalStateException on connection
    via springframework by zoeacook
    ,
  • Hibernate try to execute this typical Oracle syntax on my SqlServer 2000 as shown below: my id configuration is: <id name="pkid" type="long" column="pkid" unsaved-value="null"> <generator class="native"> <param name="sequence">seq_pro_aoo</param> </generator> </id> Trace log: Hibernate: select seq_pro_aoo.nextval from dual 13-ago-2003 9.32.40 it.saga.library.persistence.PersistenceConfiguration getSessionFactory INFO: SessionFactory found! 13-ago-2003 9.32.40 net.sf.hibernate.util.JDBCExceptionReporter logExceptions AVVERTENZA: SQL Error: 208, SQLState: 42S02 13-ago-2003 9.32.40 net.sf.hibernate.util.JDBCExceptionReporter logExceptions GRAVE: [Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]Invalid object name 'dual'. 13-ago-2003 9.32.40 net.sf.hibernate.util.JDBCExceptionReporter logExceptions AVVERTENZA: SQL Error: 16945, SQLState: HY000 13-ago-2003 9.32.40 net.sf.hibernate.util.JDBCExceptionReporter logExceptions GRAVE: [Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]The cursor was not declared. 13-ago-2003 9.32.40 net.sf.hibernate.JDBCException <init> GRAVE: Could not save object java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]Invalid object name 'dual'. at com.microsoft.jdbc.base.BaseExceptions.createException(Unknown Source) at com.microsoft.jdbc.base.BaseExceptions.getException(Unknown Source) at com.microsoft.jdbc.sqlserver.tds.TDSRequest.processErrorToken(Unknown Source) at com.microsoft.jdbc.sqlserver.tds.TDSRequest.processReplyToken(Unknown Source) at com.microsoft.jdbc.sqlserver.tds.TDSRPCRequest.processReplyToken(Unknown Source) at com.microsoft.jdbc.sqlserver.tds.TDSRequest.processReply(Unknown Source) at com.microsoft.jdbc.sqlserver.tds.TDSCursorRequest.openCursor(Unknown Source) at com.microsoft.jdbc.sqlserver.SQLServerImplStatement.execute(Unknown Source) at com.microsoft.jdbc.base.BaseStatement.commonExecute(Unknown Source) at com.microsoft.jdbc.base.BaseStatement.executeQueryInternal(Unknown Source) at com.microsoft.jdbc.base.BasePreparedStatement.executeQuery(Unknown Source) at com.evermind.sql.FilterPreparedStatement.executeQuery(FilterPreparedStatement.java:271) at com.evermind.sql.FilterPreparedStatement.executeQuery(FilterPreparedStatement.java:271) at com.evermind.sql.FilterPreparedStatement.executeQuery(FilterPreparedStatement.java:271) at net.sf.hibernate.id.SequenceGenerator.generate(SequenceGenerator.java:61) at net.sf.hibernate.impl.SessionImpl.save(SessionImpl.java:599) at net.sf.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:1202) at it.saga.library.persistence.PersistentStatelessBean.save(PersistentStatelessBean.java:179) at it.saga.pubblici.protocollo.impl.BLGProAOOBean.save(BLGProAOOBean.java:38) at BLGProAOO_StatelessSessionBeanWrapper30.save(BLGProAOO_StatelessSessionBeanWrapper30.java:180) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at com.evermind.server.rmi.RMICallHandler.run(RMICallHandler.java:119) at com.evermind.server.rmi.RMICallHandler.run(RMICallHandler.java:48) at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:803) at java.lang.Thread.run(Thread.java:536) 13-ago-2003 9.32.40 net.sf.hibernate.util.JDBCExceptionReporter logWarnings AVVERTENZA: SQL Warning: 0, SQLState: 13-ago-2003 9.32.40 net.sf.hibernate.util.JDBCExceptionReporter logWarnings AVVERTENZA: [Microsoft][SQLServer 2000 Driver for JDBC]Database changed to Protocollo 13-ago-2003 9.32.40 net.sf.hibernate.util.JDBCExceptionReporter logWarnings AVVERTENZA: SQL Warning: 0, SQLState: 13-ago-2003 9.32.40 net.sf.hibernate.util.JDBCExceptionReporter logWarnings AVVERTENZA: [Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]Changed database context to 'Protocollo'. 13-ago-2003 9.32.41 net.sf.hibernate.util.JDBCExceptionReporter logWarnings AVVERTENZA: SQL Warning: 0, SQLState: 13-ago-2003 9.32.41 net.sf.hibernate.util.JDBCExceptionReporter logWarnings AVVERTENZA: [Microsoft][SQLServer 2000 Driver for JDBC]Language changed to us_english 13-ago-2003 9.32.41 net.sf.hibernate.util.JDBCExceptionReporter logWarnings AVVERTENZA: SQL Warning: 0, SQLState: 13-ago-2003 9.32.41 net.sf.hibernate.util.JDBCExceptionReporter logWarnings AVVERTENZA: [Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]Changed language setting to us_english. java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]Invalid object name 'dual'. at com.microsoft.jdbc.base.BaseExceptions.createException(Unknown Source) at com.microsoft.jdbc.base.BaseExceptions.getException(Unknown Source) at com.microsoft.jdbc.sqlserver.tds.TDSRequest.processErrorToken(Unknown Source) at com.microsoft.jdbc.sqlserver.tds.TDSRequest.processReplyToken(Unknown Source) at com.microsoft.jdbc.sqlserver.tds.TDSRPCRequest.processReplyToken(Unknown Source)
    via by Fabio Parise,
  • (from http://forum.hibernate.org/viewtopic.php?p=2190300#2190300) Problem: Hibernate pukes (see stack trace) because of the brackets [] around a column name (Site Type (yes, there is a space in the column name)) in the WHERE clause of a SET mapping. <set name="tableSubAs" inverse="true" where="[Site Type]=1" > How do I get around this? I've tried backticks ` and apostrophes ' but these don't work either. Detailed description: I'm working with a legacy database which has a table (TableA) with a column whose name includes a space. The column name is "Site Type". It just so happens that this column is a discriminator value for subclasses to TableA (like TableSubA). In my mapping document, I have a property mapping for this column that works just fine: <property name="siteType" type="byte" column="[Site Type]" length="3" /> Notice the brackets [ ] used around the column name b/c of the space. However, another table (TableB) contains a set of TableSubA's (the subclass). In order for the set to only contain the subclass, I need to use the WHERE clause in the set mapping (see FAQ http://www.hibernate.org/117.html#A13) to specify the included elements should have a Site Type of 1. <set name="tableSubAs" inverse="true" where="[Site Type]=1" > <key> <column name="id" /> </key> <one-to-many class="foo.TableSubA" /> </set> Stack trace: org.springframework.jdbc.BadSqlGrammarException: Bad SQL grammar [null] in task 'HibernateAccessor'; nested exception is: java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]Invalid column name 'Site clients0_.Type'. java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]Invalid column name 'Site clients0_.Type'. at com.microsoft.jdbc.base.BaseExceptions.createException(Unknown Source) at com.microsoft.jdbc.base.BaseExceptions.getException(Unknown Source) at com.microsoft.jdbc.sqlserver.tds.TDSRequest.processErrorToken(Unknown Source) at com.microsoft.jdbc.sqlserver.tds.TDSRequest.processReplyToken(Unknown Source) at com.microsoft.jdbc.sqlserver.tds.TDSRPCRequest.processReplyToken(Unknown Source) at com.microsoft.jdbc.sqlserver.tds.TDSRequest.processReply(Unknown Source) at com.microsoft.jdbc.sqlserver.SQLServerImplStatement.getNextResultType(Unknown Source) at com.microsoft.jdbc.base.BaseStatement.commonTransitionToState(Unknown Source) at com.microsoft.jdbc.base.BaseStatement.postImplExecute(Unknown Source) at com.microsoft.jdbc.base.BasePreparedStatement.postImplExecute(Unknown Source) at com.microsoft.jdbc.base.BaseStatement.commonExecute(Unknown Source) at com.microsoft.jdbc.base.BaseStatement.executeQueryInternal(Unknown Source) at com.microsoft.jdbc.base.BasePreparedStatement.executeQuery(Unknown Source) at net.sf.hibernate.impl.BatcherImpl.getResultSet(BatcherImpl.java:83) at net.sf.hibernate.loader.Loader.getResultSet(Loader.java:794) at net.sf.hibernate.loader.Loader.doQuery(Loader.java:188) at net.sf.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:132) at net.sf.hibernate.loader.Loader.loadCollection(Loader.java:909) at net.sf.hibernate.loader.Loader.loadCollection(Loader.java:884) at net.sf.hibernate.loader.OneToManyLoader.initialize(OneToManyLoader.java:80) at net.sf.hibernate.collection.AbstractCollectionPersister.initialize(AbstractCollectionPersister.java:284) at net.sf.hibernate.impl.SessionImpl.initializeCollection(SessionImpl.java:3133) at net.sf.hibernate.collection.PersistentCollection.forceInitialization(PersistentCollection.java:331) at net.sf.hibernate.impl.SessionImpl.initializeNonLazyCollections(SessionImpl.java:3007) at net.sf.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:137) at net.sf.hibernate.loader.Loader.loadEntity(Loader.java:830) at net.sf.hibernate.loader.Loader.loadEntity(Loader.java:850) at net.sf.hibernate.loader.EntityLoader.load(EntityLoader.java:57) at net.sf.hibernate.loader.EntityLoader.load(EntityLoader.java:49) at net.sf.hibernate.persister.EntityPersister.load(EntityPersister.java:420) at net.sf.hibernate.impl.SessionImpl.doLoad(SessionImpl.java:2044) at net.sf.hibernate.impl.SessionImpl.doLoadByClass(SessionImpl.java:1918) at net.sf.hibernate.impl.SessionImpl.load(SessionImpl.java:1847) at org.springframework.orm.hibernate.HibernateTemplate$3.doInHibernate(HibernateTemplate.java:221) at org.springframework.orm.hibernate.HibernateTemplate.execute(HibernateTemplate.java:147) at org.springframework.orm.hibernate.HibernateTemplate.load(HibernateTemplate.java:219) at dars.clientmap.dao.hibernate.StateDaoHibernate.loadState(StateDaoHibernate.java:21) at dars.clientmap.dao.AbstractStateDaoTest.testLoadStateRealState(AbstractStateDaoTest.java:31) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at junit.framework.TestCase.runTest(TestCase.java:154) at junit.framework.TestCase.runBare(TestCase.java:127) at junit.framework.TestResult$1.protect(TestResult.java:106) at junit.framework.TestResult.runProtected(TestResult.java:124) at junit.framework.TestResult.run(TestResult.java:109) at junit.framework.TestCase.run(TestCase.java:118) at junit.framework.TestSuite.runTest(TestSuite.java:208) at junit.framework.TestSuite.run(TestSuite.java:203) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:397) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:281) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:173) org.springframework.jdbc.BadSqlGrammarException: Bad SQL grammar [null] in task 'HibernateAccessor'; nested exception is: java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]Invalid column name 'Site clients0_.Type'. org.springframework.jdbc.BadSqlGrammarException: Bad SQL grammar [null] in task 'HibernateAccessor'; nested exception is: java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]Invalid column name 'Site clients0_.Type'. java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]Invalid column name 'Site clients0_.Type'. org.springframework.jdbc.BadSqlGrammarException: Bad SQL grammar [null] in task 'HibernateAccessor'; nested exception is: java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]Invalid column name 'Site clients0_.Type'. java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]Invalid column name 'Site clients0_.Type'. at com.microsoft.jdbc.base.BaseExceptions.createException(Unknown Source) at com.microsoft.jdbc.base.BaseExceptions.getException(Unknown Source) at com.microsoft.jdbc.sqlserver.tds.TDSRequest.processErrorToken(Unknown Source) at com.microsoft.jdbc.sqlserver.tds.TDSRequest.processReplyToken(Unknown Source) at com.microsoft.jdbc.sqlserver.tds.TDSRPCRequest.processReplyToken(Unknown Source) at com.microsoft.jdbc.sqlserver.tds.TDSRequest.processReply(Unknown Source) at com.microsoft.jdbc.sqlserver.SQLServerImplStatement.getNextResultType(Unknown Source) at com.microsoft.jdbc.base.BaseStatement.commonTransitionToState(Unknown Source) at com.microsoft.jdbc.base.BaseStatement.postImplExecute(Unknown Source) at com.microsoft.jdbc.base.BasePreparedStatement.postImplExecute(Unknown Source) at com.microsoft.jdbc.base.BaseStatement.commonExecute(Unknown Source) at com.microsoft.jdbc.base.BaseStatement.executeQueryInternal(Unknown Source) at com.microsoft.jdbc.base.BasePreparedStatement.executeQuery(Unknown Source) at net.sf.hibernate.impl.BatcherImpl.getResultSet(BatcherImpl.java:83) at net.sf.hibernate.loader.Loader.getResultSet(Loader.java:794) at net.sf.hibernate.loader.Loader.doQuery(Loader.java:188) at net.sf.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:132) at net.sf.hibernate.loader.Loader.loadCollection(Loader.java:909) at net.sf.hibernate.loader.Loader.loadCollection(Loader.java:884) at net.sf.hibernate.loader.OneToManyLoader.initialize(OneToManyLoader.java:80) at net.sf.hibernate.collection.AbstractCollectionPersister.initialize(AbstractCollectionPersister.java:284) at net.sf.hibernate.impl.SessionImpl.initializeCollection(SessionImpl.java:3133) at net.sf.hibernate.collection.PersistentCollection.forceInitialization(PersistentCollection.java:331) at net.sf.hibernate.impl.SessionImpl.initializeNonLazyCollections(SessionImpl.java:3007) at net.sf.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:137) at net.sf.hibernate.loader.Loader.loadEntity(Loader.java:830) at net.sf.hibernate.loader.Loader.loadEntity(Loader.java:850) at net.sf.hibernate.loader.EntityLoader.load(EntityLoader.java:57) at net.sf.hibernate.loader.EntityLoader.load(EntityLoader.java:49) at net.sf.hibernate.persister.EntityPersister.load(EntityPersister.java:420) at net.sf.hibernate.impl.SessionImpl.doLoad(SessionImpl.java:2044) at net.sf.hibernate.impl.SessionImpl.doLoadByClass(SessionImpl.java:1918) at net.sf.hibernate.impl.SessionImpl.load(SessionImpl.java:1847) at org.springframework.orm.hibernate.HibernateTemplate$3.doInHibernate(HibernateTemplate.java:221) at org.springframework.orm.hibernate.HibernateTemplate.execute(HibernateTemplate.java:147) at org.springframework.orm.hibernate.HibernateTemplate.load(HibernateTemplate.java:219) at dars.clientmap.dao.hibernate.StateDaoHibernate.loadState(StateDaoHibernate.java:21) at dars.clientmap.dao.AbstractStateDaoTest.testLoadStateRealState(AbstractStateDaoTest.java:31) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at junit.framework.TestCase.runTest(TestCase.java:154) at junit.framework.TestCase.runBare(TestCase.java:127) at junit.framework.TestResult$1.protect(TestResult.java:106) at junit.framework.TestResult.runProtected(TestResult.java:124) at junit.framework.TestResult.run(TestResult.java:109) at junit.framework.TestCase.run(TestCase.java:118) at junit.framework.TestSuite.runTest(TestSuite.java:208) at junit.framework.TestSuite.run(TestSuite.java:203) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:397) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:281) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:173)
    via by Jon Chase,
    • java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]The cursor was not declared. at com.microsoft.jdbc.base.BaseExceptions.createException(UnknownSource) at com.microsoft.jdbc.base.BaseExceptions.getException(Unknown Source) at com.microsoft.jdbc.sqlserver.tds.TDSRequest.processErrorToken(UnknownSource) at com.microsoft.jdbc.sqlserver.tds.TDSRequest.processReplyToken(UnknownSource) at com.microsoft.jdbc.sqlserver.tds.TDSRPCRequest.processReplyToken(UnknownSource) at com.microsoft.jdbc.sqlserver.tds.TDSRequest.processReply(UnknownSource) at com.microsoft.jdbc.sqlserver.tds.TDSCursorRequest.openCursor(UnknownSource) at com.microsoft.jdbc.sqlserver.SQLServerImplStatement.execute(UnknownSource) at com.microsoft.jdbc.base.BaseStatement.commonExecute(Unknown Source) at com.microsoft.jdbc.base.BaseStatement.executeQueryInternal(UnknownSource) at com.microsoft.jdbc.base.BasePreparedStatement.executeQuery(UnknownSource) at com.solarmetric.jdbc.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:353) at com.solarmetric.jdbc.PoolConnection$PoolPreparedStatement.executeQuery(PoolConnection.java:333) at com.solarmetric.jdbc.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:351) at com.solarmetric.jdbc.LoggingConnectionDecorator$LoggingConnection$LoggingPreparedStatement.executeQuery(LoggingConnectionDecorator.java:704) at com.solarmetric.jdbc.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:351) at kodo.jdbc.runtime.JDBCStoreManager$CancelPreparedStatement.executeQuery(JDBCStoreManager.java:1706) at com.solarmetric.jdbc.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:338) at kodo.jdbc.runtime.JDBCStoreManager.getResultInternal(JDBCStoreManager.java:1010)

    Users with the same issue

    rp
    rp1 times, last one,
    Unknown visitor1 times, last one,