Sybase throws Exception "there is already another cursor with the name XXX" when Executing SELECT Query in multi-threading environment
Asked Answered
C

0

6

I am using ApacheMetaModel to Extract the data from Sybase ASE 15.5 database that installed on Windows 7 machine. I am Extracting data into CSV in multi-threading environment. I using these open source libraries

        <dependency>
            <groupId>com.sybase</groupId>
            <artifactId>jconn4</artifactId>
            <version>4.0</version>
        </dependency>
        <dependency>
            <groupId>com.sybase</groupId>
            <artifactId>DDLGen</artifactId>
            <version>4.0</version>
        </dependency>
        <dependency>
            <groupId>com.sybase</groupId>
            <artifactId>dsparser</artifactId>
            <version>4.0</version>
        </dependency>

I am getting the error when I am trying to execute the SELECT query. It does not throw an Exception for any particular query. It can throw an Exception for any Table. I am trying to create a query using Apache Meta-model DataContext.

Query query = dataContext.query().from(table).as("ct").selectAll().toQuery();
dataContext.executeQuery(query).iterator();

The above code will create query like:

SELECT ct."Column1", ct."Column2", ct."Column3", ct."Column4", ct."Column5", ct."Column6", ct."Column7", ct."Column8", ct."Column9", ct."id" FROM schemaowner."tablename" ct

The following is the stack trace:

! com.sybase.jdbc4.jdbc.SybSQLException: There is already another cursor with the name 'jconnect_implicit_134' at the nesting level '0'.

! 

! at com.sybase.jdbc4.tds.Tds.processEed(Tds.java:4117) ~[jconn4-4.0.jar:JDK 1.6/jdbcmain/Thu Apr 30 04:18:00 PDT 2015]

! at com.sybase.jdbc4.tds.Tds.nextResult(Tds.java:3207) ~[jconn4-4.0.jar:JDK 1.6/jdbcmain/Thu Apr 30 04:18:00 PDT 2015]

! at com.sybase.jdbc4.tds.Tds.getResultSetResult(Tds.java:3973) ~[jconn4-4.0.jar:JDK 1.6/jdbcmain/Thu Apr 30 04:18:00 PDT 2015]

! at com.sybase.jdbc4.tds.TdsCursor.open(TdsCursor.java:328) ~[jconn4-4.0.jar:JDK 1.6/jdbcmain/Thu Apr 30 04:18:00 PDT 2015]

! at com.sybase.jdbc4.jdbc.SybStatement.executeQuery(SybStatement.java:2604) ~[jconn4-4.0.jar:JDK 1.6/jdbcmain/Thu Apr 30 04:18:00 PDT 2015]

! at com.sybase.jdbc4.jdbc.SybStatement.executeQuery(SybStatement.java:555) ~[jconn4-4.0.jar:JDK 1.6/jdbcmain/Thu Apr 30 04:18:00 PDT 2015]

! at org.eobjects.metamodel.jdbc.JdbcDataContext.execute(JdbcDataContext.java:381) ~[MetaModel-jdbc-3.4.7.jar:na]

! at org.eobjects.metamodel.jdbc.JdbcDataContext.executeQuery(JdbcDataContext.java:438) ~[MetaModel-jdbc-3.4.7.jar:na]

! Causing: org.eobjects.metamodel.MetaModelException: Could not execute query: There is already another cursor with the name 'jconnect_implicit_134' at the nesting level '0'.

! 

! at org.eobjects.metamodel.jdbc.JdbcUtils.wrapException(JdbcUtils.java:70) ~[MetaModel-jdbc-3.4.7.jar:na]

! at org.eobjects.metamodel.jdbc.JdbcDataContext.executeQuery(JdbcDataContext.java:444) ~[MetaModel-jdbc-3.4.7.jar:na]
Chiquitachirico answered 11/2, 2016 at 10:21 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.