Results 1 to 2 of 2
  1. #1
    Join Date
    Jan 2002
    Posts
    1

    Exclamation Unanswered: jdbc1 vs. jdbc2 errors help!

    Hi,
    We are on db2 7.2 on win2k and were using the JDBC1 drivers and all was
    working fine. We just switched to the JDBC2 driver and now are seeing tons
    of errors that we never saw before.

    Example code that works in db2 jdbc1 driver.

    // get statement
    op = con.prepareStatement(sql);

    try {
    rs = op.executeQuery();
    }
    catch (SQLException e) {
    log("Die on executing statement in genericSqlGet()"+ sql,e);
    }

    // build result collection
    try {
    while (rs.next()) {
    .............
    ..........


    However when switching to db2's JDBC2 driver we get the following exception
    when calling rs.next() (note the executeQuery() and prepareStatement() throw
    no execeptions.

    EXCEPTION: COM.ibm.db2.jdbc.DB2Exception: [IBM][CLI Driver][DB2/NT]
    SQL0501N The cursor specified in a FETCH or CLOSE statement is not open.
    SQLSTATE=24501

    COM.ibm.db2.jdbc.DB2Exception: [IBM][CLI Driver][DB2/NT] SQL0501N The
    cursor specified in a FETCH or CLOSE statement is not open. SQLSTATE=24501

    at
    COM.ibm.db2.jdbc.app.SQLExceptionGenerator.throw_S QLException(SQLExceptionGe
    nerator.java:254)
    at
    COM.ibm.db2.jdbc.app.SQLExceptionGenerator.throw_S QLException(SQLExceptionGe
    nerator.java:197)
    at
    COM.ibm.db2.jdbc.app.SQLExceptionGenerator.check_r eturn_code(SQLExceptionGen
    erator.java:436)
    at COM.ibm.db2.jdbc.app.DB2ResultSet.next(DB2ResultSe t.java:473)

  2. #2
    Join Date
    Jan 2002
    Posts
    6

    Unhappy

    we are using JDBC 2 driver and have never experienced this error. I have checked your piece of source against our sources and I dont see a problem. Are you sure the Exception occurs in this piece of code ??

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •