Skip to Main Content

Database Software

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Intermittent Function sequence error in JDBC - ReferenceManager too eager?

599140Oct 17 2007 — edited Oct 22 2007
Hello,

I'm experiencing intermittent "function sequence error" when executing the first next() on a resultset.

The java code:

protected String getNextSequenceId(Connection con) throws DAOException {
String nextVal = null;
PreparedStatement ps = null;
ResultSet rs = null;
try {
ps = getPreparedStatement(con, "SELECT sq_JobsID.NEXTVAL FROM DUAL");
ps.executeQuery();
rs = ps.getResultSet();
if(rs.next()) {
nextVal = rs.getString(1);
}
} catch(SQLException se) {
handleSQLException(se);
} finally {
closeResultSet(rs);
closeStatement(ps);
}
return nextVal;
}


Enabling timesten trace logging reveals that the ReferenceManager finalizes the resultset before I get a chance to read from it. Any idea what could be done to prevent this?

Would changing to code to do "rs=ps.executeQuery();" instead of "ps.executeQuery(); rs = ps.getResultSet();" fix the problem?

Thanks.

BTW, I'm using TimesTen 7.0.3. The problem was seen both on Windows XP and Solaris 10.

TimesTen Trace log:

HttpThreadPool-8*JdbcOdbc.SQLPrepare(184632064, SELECT sq_JobsID.NEXTVAL FROM DUAL)
HttpThreadPool-8*JdbcOdbc.SQLGetStmtOption(184632064, 3031)
HttpThreadPool-8*JdbcOdbc.SQLGetStmtOption(184632064) Returning value = 0
HttpThreadPool-8*JdbcOdbc.SQLNumParams(184632064)
HttpThreadPool-8*JdbcOdbc.SQLNumParams(184632064) Returning: numParams = 0
HttpThreadPool-8*Connection.registerStatement(com.timesten.jdbc.JdbcOdbcPreparedStatement@114c15d)
HttpThreadPool-8*PreparedStatement.executeQuery()
HttpThreadPool-8*PreparedStatement.execute()
HttpThreadPool-8*JdbcOdbc.SQLExecute(184632064)
HttpThreadPool-8*JdbcOdbc.SQLExecute(184632064): Returning needData=false
HttpThreadPool-8*JdbcOdbc.SQLNumResultCols(184632064)
HttpThreadPool-8*JdbcOdbc.SQLNumResultCols(hStmt=184632064): Returning numCols = 1
HttpThreadPool-8*Statement.getResultSet()
HttpThreadPool-8*JdbcOdbc.SQLNumResultCols(184632064)
HttpThreadPool-8*JdbcOdbc.SQLNumResultCols(hStmt=184632064): Returning numCols = 1
HttpThreadPool-8*JdbcOdbc.SQLAllocAndBindCols(184632064)
HttpThreadPool-8*Statement.getResultSet()

HttpThreadPool-8*ReferenceManager.handleReference(com.timesten.jdbc.BasicPhantomReference@1d43f63)
HttpThreadPool-8*JdbcOdbcResultSet.doPostFinalization(com.timesten.jdbc.JdbcOdbcResultSet@18dacb5)
HttpThreadPool-8*JdbcOdbcResultSet.close()
HttpThreadPool-8*JdbcOdbc.SQLFreeStmt(184632064, 0)

HttpThreadPool-8*JdbcOdbcResultSet.next()
HttpThreadPool-8*JdbcOdbc.SQLFetch(184632064)
HttpThreadPool-8*JdbcOdbc.standardError(-1, 0, 0, 184632064)
HttpThreadPool-8*JdbcOdbc.createSQLException(0, 0, 184632064, true, true)
HttpThreadPool-8*JdbcOdbc.createSQLException:Reason = [TimesTen][TimesTen 7.0.3.0.0 ODBC Driver]Function sequence error; SQLstate = S1010; VendorCode = 0
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 19 2007
Added on Oct 17 2007
17 comments
3,248 views