July 11, 2003 at 1:38 pm
I am new to SQLServer and I am trying to save and retrieve data using the text data type. My data is 9000bytes long and when I try to retrieve I get the following error:
java.sql.SQLException: [Microsoft][SQL Server 2000 Driver for JDBC]ResultSet can not re-read row data for column 1
Any help in solving this problem is highly appreciated.
Thanks
July 11, 2003 at 2:07 pm
Please post the code which is generating the error so we can take a look.
July 11, 2003 at 2:35 pm
I am just using a select statement to retrieve the text value from Java code using Microsoft JDBC driver.
Thanks
July 11, 2003 at 2:40 pm
What is the statement? If you don't post either the SQL or the Java code, we won't know what the issue is or where the bug lies. My guess is that the JDBC driver is throwing up with the Text data type, but I won't know until I see the code.
July 11, 2003 at 2:59 pm
Here's my connection code:
stmt = con.createStatement();
rs = stmt.executeQuery(query);
where con is my connection . Table EsPage has 2 fields, name and comments. Comments is text data type. The query and error I get is:
[7/11/03 14:45:12:996 MDT] 56980fdf SystemOut U Query = SELECT * FROM EsPage WHERE (userName = 'ddde');
java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC]ResultSet can not re-read row data for column 1.
at com.microsoft.jdbc.base.BaseExceptions.createException(Unknown Source)
at com.microsoft.jdbc.base.BaseExceptions.getException(Unknown Source)
at com.microsoft.jdbc.base.BaseResultSet.validateColumnIndex(Unknown Source)
at com.microsoft.jdbc.base.BaseResultSet.getString(Unknown Source)
at com.microsoft.jdbc.base.BaseResultSet.getString(Unknown Source)
at edu.cme.ejb.EsPageBean.find_ByPrimaryKey(EsPageBean.java:327)
at edu.cme.ejb.EJSRemoteBMPEsPage.find_ByPrimaryKey(EJSRemoteBMPEsPage.java:289)
at edu.cme.ejb._EsPage_Stub.find_ByPrimaryKey(_EsPage_Stub.java:257)
at edu.cme.admissions.application.EditEsPageAction.perform(EditEsPageAction.java:64)
at org.apache.struts.action.ActionServlet.processActionPerform(ActionServlet.java:1737)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1547)
at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:491)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.ibm.servlet.engine.webapp.StrictServletInstance.doService(ServletManager.java:827)
at com.ibm.servlet.engine.webapp.StrictLifecycleServlet._service(StrictLifecycleServlet.java:167)
at com.ibm.servlet.engine.webapp.IdleServletState.service(StrictLifecycleServlet.java:297)
at com.ibm.servlet.engine.webapp.StrictLifecycleServlet.service(StrictLifecycleServlet.java:110)
at com.ibm.servlet.engine.webapp.ServletInstance.service(ServletManager.java:472)
at com.ibm.servlet.engine.webapp.ValidServletReferenceState.dispatch(ServletManager.java:1012)
at com.ibm.servlet.engine.webapp.ServletInstanceReference.dispatch(ServletManager.java:913)
at com.ibm.servlet.engine.webapp.WebAppRequestDispatcher.handleWebAppDispatch(WebAppRequestDispatcher.java:523)
July 11, 2003 at 3:42 pm
It's not an issue with the SQL, it's an issue with the JDBC driver and the TEXT data type. See this link for an explanation:
looks like Java doesn't play nice with SQL TEXT or IMAGE data types.
July 11, 2003 at 4:13 pm
Thanks. I guess I have to find a new driver then
July 14, 2003 at 6:13 am
java plays very well with sql...there are a few things to do however, in order to produce a usable outcome in your situation...
first, create the statement with the following code:
Statement stmt = con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE);
ResultSet rsResultset = stmt.executeQuery(<your sql SELECT here>);
...at this point you can try to read the row, then move backward and read it again...if it works, kewl - if not, you've got two choices:
roll the resultset forward and store your data in some type of array of vector on the first read or, get an updated driver...
fyi - most shops don't use the standard sun jdbc drivers for this and other reasons - but just make sure you use JDK 1.4+ and you should be able to do this...
we use JDataConnect - it does just about everything we need...
good luck!
Viewing 8 posts - 1 through 7 (of 7 total)
You must be logged in to reply to this topic. Login to reply