Exception executing simple statement

From: Frank Brouwer (frank.brouwer_nospam_at_trimergo.nl)
Date: 10/20/03

  • Next message: Mladen Adamovic: "Re: Secure connection to a SQL database from a Java client"
    Date: Mon, 20 Oct 2003 10:47:55 +0200
    
    

    Hi all,

    Executing next statement results in Exception below:

    select t1.calendar_key, t1.calbase_key, t1.description, t1.calendar_number
    from calendar_global t1
    where t1.calendar_key = ?

    And here is the java coding:

    // Setup stuff for reading the calendars.
    PreparedStatement ps =
    con.prepareStatement(CalendarDataSql().getGlobalCalendarSql());
    PreparedStatement ps1 =
    con.prepareStatement(CalendarDataSql().getBaseCalendarSql());
    PreparedStatement ps2 =
    con.prepareStatement(CalendarDataSql().getDetailsCalendarSql());
    ResultSet rs;

       // Set parameter and execute statement.
       ps.setString(1,cid);
       rs = ps.executeQuery(); <== First Exception on this line (see below).

       // If no reccord, return null otherwise process this reccord and
    continue.
       if (!rs.next()) return null; <== Seccond, third, fourth, .... time
    executing, Exception here (see below).

    --------- First exception --------------
    java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for
    JDBC][SQLServer]sp_cursorfetch: The cursor identifier value provided (0) is
    not valid.
     at
    com.microsoft.jdbc.base.BaseExceptions.createException(Ljava.lang.String;Lja
    va.lang.String;I)Ljava.sql.SQLException;(Unknown Source)
     at
    com.microsoft.jdbc.base.BaseExceptions.getException(Ljava.sql.SQLException;I
    I[Ljava.lang.String;Ljava.lang.String;I)Ljava.sql.SQLException;(Unknown
    Source)
     at com.microsoft.jdbc.sqlserver.tds.TDSRequest.processErrorToken()V(Unknown
    Source)
     at
    com.microsoft.jdbc.sqlserver.tds.TDSRequest.processReplyToken(BLcom.microsof
    t.jdbc.base.BaseWarnings;)Z(Unknown Source)
     at
    com.microsoft.jdbc.sqlserver.tds.TDSRPCRequest.processReplyToken(BLcom.micro
    soft.jdbc.base.BaseWarnings;)Z(Unknown Source)
     at
    com.microsoft.jdbc.sqlserver.tds.TDSRequest.processReply(Lcom.microsoft.jdbc
    .base.BaseWarnings;)V(Unknown Source)
     at
    com.microsoft.jdbc.sqlserver.tds.TDSCursorRequest.openCursor(Lcom.microsoft.
    jdbc.base.BaseWarnings;)V(Unknown Source)
     at com.microsoft.jdbc.sqlserver.SQLServerImplStatement.execute()V(Optimized
    Method)
     at com.microsoft.jdbc.base.BaseStatement.commonExecute()V(Unknown Source)
     at
    com.microsoft.jdbc.base.BaseStatement.executeQueryInternal()Ljava.sql.Result
    Set;(Unknown Source)
     at
    com.microsoft.jdbc.base.BasePreparedStatement.executeQuery()Ljava.sql.Result
    Set;(Unknown Source)

    ------------------ Rest truncated ------------------------

    -------------------- Seccond, third, fourth, ..... exception.
    java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC]Unhandled
    token type: ROW
     at
    com.microsoft.jdbc.base.BaseExceptions.createException(Ljava.lang.String;Lja
    va.lang.String;)Ljava.sql.SQLException;(Unknown Source)
     at
    com.microsoft.jdbc.base.BaseExceptions.getException(I[Ljava.lang.String;)Lja
    va.sql.SQLException;(Unknown Source)
     at
    com.microsoft.jdbc.sqlserver.tds.TDSRequest.processReplyToken(BLcom.microsof
    t.jdbc.base.BaseWarnings;)Z(Unknown Source)
     at
    com.microsoft.jdbc.sqlserver.tds.TDSRPCRequest.processReplyToken(BLcom.micro
    soft.jdbc.base.BaseWarnings;)Z(Unknown Source)
     at
    com.microsoft.jdbc.sqlserver.tds.TDSRequest.processReply(Lcom.microsoft.jdbc
    .base.BaseWarnings;)V(Unknown Source)
     at
    com.microsoft.jdbc.sqlserver.tds.TDSCursorRequest.openCursor(Lcom.microsoft.
    jdbc.base.BaseWarnings;)V(Unknown Source)
     at com.microsoft.jdbc.sqlserver.SQLServerImplStatement.execute()V(Optimized
    Method)
     at com.microsoft.jdbc.base.BaseStatement.commonExecute()V(Unknown Source)
     at
    com.microsoft.jdbc.base.BaseStatement.executeQueryInternal()Ljava.sql.Result
    Set;(Unknown Source)
     at
    com.microsoft.jdbc.base.BasePreparedStatement.executeQuery()Ljava.sql.Result
    Set;(Unknown Source)

    ------------------------ Rest truncated ------------------------

    Who has a clue????

    Thanks,

    Frank.


  • Next message: Mladen Adamovic: "Re: Secure connection to a SQL database from a Java client"

    Relevant Pages

    • CreateThread() throws duplicate TLB exception on MIPS (CE5)
      ... I have a driver that spawns a thread when in active power state (D0- ... After executing a system suspend and subsequent resume, ... the MIPS and RMI manuals say of this exception: ...
      (microsoft.public.windowsce.platbuilder)
    • RE: JDBC and handling of errors
      ... this is not a bug with jdbc driver. ... executing the procedure. ... driver in order to get to the result containing the exception. ...
      (microsoft.public.sqlserver.clients)
    • Unexpected Exception when inserting data in SQL 2000
      ... Our application has run for years using the SQL 2000 JDBC and the jTDS ... I recently tried using the SQL 2005 driver, ... The SQL 2005 is giving us the exception as expected. ... the preparedstatement in the debugger, ...
      (microsoft.public.sqlserver.jdbcdriver)
    • Re: Structured Exception Handling (was: Try Finally...)
      ... >statements will be traversed outwards exactly once, executing each ... What really bite me is the re-raise of the exception ... and the continuation in statementList2. ... This means that during unwinding the code immediately returns, ...
      (comp.lang.pascal.delphi.misc)
    • Re: Why finally?
      ... I get the same results from executing the code as well. ... This seems to be a definite improvement of V1.x of the framework. ... normal exception paths. ... // Inject an asynchronous ThreadAbortException in the target thread, ...
      (microsoft.public.dotnet.languages.csharp)