By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,710 Members | 1,960 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,710 IT Pros & Developers. It's quick & easy.

updateString error in PostgreSQL7.4 with JDBC

P: n/a
Hi,
I have a problem with PostgreSQL 7.4. (With the old one 7.3 no probllem.)

I create a connection and a statement :
Class.forName("org.postgresql.Driver");
conn = DriverManager.getConnection(
O_Constants.DB_CONNECTION_URL,
O_Constants.DB_CONNECTION_USERNAME,
O_Constants.DB_CONNECTION_PASSWORD);
st = conn.createStatement(ResultSet.TYPE_SCROLL_SENSITI VE,
ResultSet.CONCUR_UPDATABLE);
rs = st.executeQuery("select * ...";

Then:
rs.updateString(20 , ...);

The error is:
org.postgresql.util.PSQLException: Cannot update the result set because
it is either before the start or after the end of the results.
at
org.postgresql.jdbc2.AbstractJdbc2ResultSet.update Value(AbstractJdbc2ResultSet.java:1595)
at
org.postgresql.jdbc2.AbstractJdbc2ResultSet.update String(AbstractJdbc2ResultSet.java:1193)
at admin.ValidationRequest.doGet(ValidationRequest.ja va:43)
at javax.servlet.http.HttpServlet.service(HttpServlet .java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet .java:853)
at
org.apache.catalina.core.ApplicationFilterChain.in ternalDoFilter(ApplicationFilterChain.java:247)
at
org.apache.catalina.core.ApplicationFilterChain.do Filter(ApplicationFilterChain.java:193)
at
org.apache.catalina.core.StandardWrapperValve.invo ke(StandardWrapperValve.java:256)
at
org.apache.catalina.core.StandardPipeline$Standard PipelineValveContext.invokeNext(StandardPipeline.j ava:643)
at
org.apache.catalina.core.StandardPipeline.invoke(S tandardPipeline.java:480)
at
org.apache.catalina.core.ContainerBase.invoke(Cont ainerBase.java:995)
at
org.apache.catalina.core.StandardContextValve.invo ke(StandardContextValve.java:191)
at
org.apache.catalina.core.StandardPipeline$Standard PipelineValveContext.invokeNext(StandardPipeline.j ava:643)
at
org.apache.catalina.core.StandardPipeline.invoke(S tandardPipeline.java:480)
at
org.apache.catalina.core.ContainerBase.invoke(Cont ainerBase.java:995)
at
org.apache.catalina.core.StandardContext.invoke(St andardContext.java:2422)
at
org.apache.catalina.core.StandardHostValve.invoke( StandardHostValve.java:180)
at
org.apache.catalina.core.StandardPipeline$Standard PipelineValveContext.invokeNext(StandardPipeline.j ava:643)
at
org.apache.catalina.valves.ErrorDispatcherValve.in voke(ErrorDispatcherValve.java:171)
at
org.apache.catalina.core.StandardPipeline$Standard PipelineValveContext.invokeNext(StandardPipeline.j ava:641)
at
org.apache.catalina.valves.ErrorReportValve.invoke (ErrorReportValve.java:163)
at
org.apache.catalina.core.StandardPipeline$Standard PipelineValveContext.invokeNext(StandardPipeline.j ava:641)
at
org.apache.catalina.core.StandardPipeline.invoke(S tandardPipeline.java:480)
at
org.apache.catalina.core.ContainerBase.invoke(Cont ainerBase.java:995)
at
org.apache.catalina.core.StandardEngineValve.invok e(StandardEngineValve.java:174)
at
org.apache.catalina.core.StandardPipeline$Standard PipelineValveContext.invokeNext(StandardPipeline.j ava:643)
at
org.apache.catalina.core.StandardPipeline.invoke(S tandardPipeline.java:480)
at
org.apache.catalina.core.ContainerBase.invoke(Cont ainerBase.java:995)
at
org.apache.coyote.tomcat4.CoyoteAdapter.service(Co yoteAdapter.java:199)
at
org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyo teHandler.java:324)
at
org.apache.jk.common.HandlerRequest.invoke(Handler Request.java:395)
at org.apache.jk.common.ChannelSocket.invoke(ChannelS ocket.java:673)
at
org.apache.jk.common.ChannelSocket.processConnecti on(ChannelSocket.java:615)
at
org.apache.jk.common.SocketConnection.runIt(Channe lSocket.java:786)
at
org.apache.tomcat.util.threads.ThreadPool$ControlR unnable.run(ThreadPool.java:683)
at java.lang.Thread.run(Thread.java:536)

The JDBC is:
pg74.215.jdbc3.jar

If you have any comments, please help.
Thanks...
---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend

Nov 23 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
It is ok. I fetch the row with no problem.
The error is only in update types like updateString , updateRow,
updateInt...

ps.You are right JDBC list is appropriate.
Richard Huxton wrote:
Suha Onay wrote:
Hi,
I have a problem with PostgreSQL 7.4. (With the old one 7.3 no
probllem.)

You might get a better response from the jdbc list.
I create a connection and a statement :
Class.forName("org.postgresql.Driver");
conn = DriverManager.getConnection(
O_Constants.DB_CONNECTION_URL,
O_Constants.DB_CONNECTION_USERNAME,
O_Constants.DB_CONNECTION_PASSWORD);
st = conn.createStatement(ResultSet.TYPE_SCROLL_SENSITI VE,
ResultSet.CONCUR_UPDATABLE);
rs = st.executeQuery("select * ...";

Then:
rs.updateString(20 , ...);

The error is:
org.postgresql.util.PSQLException: Cannot update the result set
because it is either before the start or after the end of the results.

What happens if you fetch a row first?


---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to ma*******@postgresql.org)

Nov 23 '05 #2

P: n/a


On Wed, 10 Nov 2004, Suha Onay wrote:
st = conn.createStatement(ResultSet.TYPE_SCROLL_SENSITI VE,
ResultSet.CONCUR_UPDATABLE);
rs = st.executeQuery("select * ...";

Then:
rs.updateString(20 , ...);

The error is:
org.postgresql.util.PSQLException: Cannot update the result set because
it is either before the start or after the end of the results.

You must be on a row (or the insert row) to update it, you have not shown
any positioning methods (like next()) being called on the ResultSet so it
is left positioned before the first row. I don't know what the 7.3 driver
was actually doing, but this error is the expected behavior of the driver,
unless of course you are doing something else you haven't shown us.

Kris Jurka

---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to ma*******@postgresql.org)

Nov 23 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.