PDA

View Full Version : CLI0145E Fetch type out of range.


Radhika
05-15-02, 11:56
Hi,
When i try to call resultset.last() method on scrollable resultset i am getting the following error message :
COM.ibm.db2.jdbc.DB2Exception: [IBM][CLI Driver] CLI0145E Fetch type out of range. SQLSTATE=HY106

I am using Visual Age for Java.

Can any one help me in this problem?

Thanks
Radhika

rnealejr
05-15-02, 16:13
What type of cursor are you using ? What other methods can you use on the resultset ?

Radhika
05-16-02, 09:20
Originally posted by rnealejr
What type of cursor are you using ? What other methods can you use on the resultset ?

I have choosen TYPE_SCROLL_INSENSITIVE and CONCUR_READ_ONLY
options for the resultset. Basically I want to get the row count in the resultset. So first method i am calling is resultSet.last(), there itself I could not proceed. Later I am using other methods like getRow(), first(), but I could not go till there.
Do u have any clue why is it giving exception?

Thanks
Radhika

rnealejr
05-16-02, 11:03
Comment out the last() method and just try executing a next twice and then a previous. Also, please post your code including the connection/statement/resultset. Let me know the results of this test - just try the next and previous methods only and see if an error is returned.

subha
05-23-02, 09:41
hi,
i've weblogic5.1 & i am working with stateless session beans. i am able to deploy the bean. but, when i run the client class, it is getting connected to the server and then, the following error occurs:
Exception java.rmi.RemoteException: java.lang.NoClassDefFoundError: org/xml/sax/InputSource
at org.jdom.input.SAXBuilder.build...........
at XMLReaderBean.readXML.............

my bean class is XMLReaderBean which would read the contents of
an xml file. hence, i've imported the org.jdom.input.SAXBuilder.

kindly, let me know how to correct this error. expecting ur immediate reply.



regards,
subha

sswieca
09-09-02, 10:06
Originally posted by rnealejr
Comment out the last() method and just try executing a next twice and then a previous. Also, please post your code including the connection/statement/resultset. Let me know the results of this test - just try the next and previous methods only and see if an error is returned.


Hello. I too am experiencing this CLI0145E with SQLSTATE=HY106 issue. . .I am also using the same params on the resultset:
ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR _READ_ONLY

I tried your suggestion to the previous person... commenting out the .last() method and then trying a few .next() and then a .previous(). These statements worked fine... yet in my next line of code I try to get the number of rows: int nbrRows = gVORS.getRow(); and it says that I have 0.

Did the two of you find a solution back in May?

Thanks so much for your help!

sswieca

dwnam
07-20-06, 23:41
hi.
I get the same message during CLI Programming.

** connection and initilization and something else are already established.**

// allocate statement handle
cliRC = SQLAllocHandle(SQL_HANDLE_STMT, m_hdbc, &m_hstmt);
DBC_HANDLE_CHECK(m_hdbc, cliRC);

cliRC = SQLSetStmtAttr(m_hstmt, SQL_ATTR_ROW_ARRAY_SIZE, (SQLPOINTER)SEARCH_PAGE_CNT, 0);
STMT_HANDLE_CHECK(m_hstmt, m_hdbc, cliRC);

cliRC = SQLSetStmtAttr(m_hstmt,SQL_ATTR_CURSOR_TYPE,(SQLPO INTER)SQL_CURSOR_STATIC,0);
STMT_HANDLE_CHECK(m_hstmt, m_hdbc, cliRC);

cliRC = SQLSetStmtAttr(m_hstmt,SQL_ATTR_USE_BOOKMARKS,(SQL POINTER)SQL_UB_VARIABLE,0);
STMT_HANDLE_CHECK(m_hstmt, m_hdbc, cliRC);

cliRC = SQLSetStmtAttr(m_hstmt,SQL_ATTR_ROWS_FETCHED_PTR, &rowsFetchedNb,0);
STMT_HANDLE_CHECK(m_hstmt, m_hdbc, cliRC);

cliRC = SQLSetStmtAttr(m_hstmt, SQL_ATTR_ROW_BIND_TYPE, (SQLPOINTER)(sizeof (LogRec) / SEARCH_PAGE_CNT),0);
STMT_HANDLE_CHECK(m_hstmt, m_hdbc, cliRC);

cliRC = SQLExecDirect(m_hstmt, (unsigned char *)(LPCTSTR)m_query, SQL_NTS);
STMT_HANDLE_CHECK(m_hstmt, m_hdbc, cliRC);

cliRC = SQLBindCol(m_hstmt,2 /*the first column is ignored */,SQL_C_TIMESTAMP,(SQLPOINTER)LogRec[0].LogDate,20,&LogRec[0].ind1);
STMT_HANDLE_CHECK(m_hstmt, m_hdbc, cliRC);

cliRC = SQLBindCol(m_hstmt,3,SQL_C_CHAR,(SQLPOINTER)LogRec [0].FWID,13, &LogRec[0].ind2);
STMT_HANDLE_CHECK(m_hstmt, pPage->m_hdbc, cliRC);

cliRC = SQLBindCol(m_hstmt,4,SQL_C_CHAR,(SQLPOINTER)LogRec [0].Code,7,&LogRec[0].ind3);
STMT_HANDLE_CHECK(m_hstmt, m_hdbc, cliRC);

cliRC = SQLBindCol(m_hstmt,5,SQL_C_CHAR,(SQLPOINTER)&LogRec[0].Priority,5,&LogRec[0].ind4);
STMT_HANDLE_CHECK(m_hstmt, m_hdbc, cliRC);

cliRC = SQLBindCol(m_hstmt,6,SQL_C_CHAR,(SQLPOINTER)&LogRec[0].ThreadID,11,&LogRec[0].ind5);
STMT_HANDLE_CHECK(m_hstmt, m_hdbc, cliRC);

cliRC = SQLBindCol(m_hstmt,7,SQL_C_CHAR,(SQLPOINTER)LogRec [0].Msg,1025,&LogRec[0].ind6);
STMT_HANDLE_CHECK(m_hstmt, m_hdbc, cliRC);

cliRC = SQLFetchScroll(m_hstmt, SQL_FETCH_ABSOLUTE, lPoint); // SQL_ERROR
STMT_HANDLE_CHECK(m_hstmt, m_hdbc, cliRC); // CLI0145E Fetch type out of range.

if (cliRC != SQL_NO_DATA_FOUND) {
for (i = 0; i < rowsFetchedNb; i++) {
pView->InsertProc(LogRec[i], i);
}
}