dbTalk Databases Forums  

updateString error in PostgreSQL7.4 with JDBC

comp.databases.postgresql.general comp.databases.postgresql.general


Discuss updateString error in PostgreSQL7.4 with JDBC in the comp.databases.postgresql.general forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Suha Onay
 
Posts: n/a

Default updateString error in PostgreSQL7.4 with JDBC - 11-10-2004 , 05:38 AM






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


Reply With Quote
  #2  
Old   
Suha Onay
 
Posts: n/a

Default Re: updateString error in PostgreSQL7.4 with JDBC - 11-10-2004 , 06:21 AM






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:

Quote:
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 majordomo (AT) postgresql (DOT) org)



Reply With Quote
  #3  
Old   
Kris Jurka
 
Posts: n/a

Default Re: updateString error in PostgreSQL7.4 with JDBC - 11-10-2004 , 10:24 PM





On Wed, 10 Nov 2004, Suha Onay wrote:

Quote:
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 majordomo (AT) postgresql (DOT) org)



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.