Re: error when using move, any suggestions?

From: Noel <noel(dot)faux(at)med(dot)monash(dot)edu(dot)au>
To: Barry Lind <blind(at)xythos(dot)com>
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: error when using move, any suggestions?
Date: 2002-12-20 00:35:00
Message-ID: 3E0265B4.7070508@med.monash.edu.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

Barry,
Thanks for the tip, however the error is still there.
Here's the code:
import blastDb.*;
import java.sql.*;
import java.io.*;
import java.util.*;
import java.lang.*;

public class TestFetchSize
{
public static void main(String[] args)
{
try
{
BlastDB db = new BlastDB();

Statement stmt = db.connection.createStatement();
int counte = 0;
//stmt.execute("begin work");
db.connection.setAutoCommit(false);
stmt.execute("declare test cursor for select id from region
where protein_database = 1");
ResultSet rs;
System.out.println("here1");
stmt.execute("move forward 99 in test");
System.out.println("here2");
while(stmt.execute("fetch forward 2 in test"))
{
rs = stmt.getResultSet();
if (rs.next())
{
++counte;
while (rs.next())
{
++counte;
}
}
else
break;

}

rs = stmt.getResultSet();
if (rs.next())
System.out.println("ok");
else
System.out.println("NO");
System.out.println(counte);
db.connection.commit();
//stmt.execute("end work");
}
catch (Exception e)
{
e.printStackTrace();
System.out.println(e.getMessage());
}
}
}

This is the output:
here1
Unable to fathom update count MOVE
at
org.postgresql.core.QueryExecutor.receiveCommandStatus(QueryExecutor.java:182)
at org.postgresql.core.QueryExecutor.execute(QueryExecutor.java:80)
at org.postgresql.Connection.ExecSQL(Connection.java:398)
at org.postgresql.jdbc2.Statement.execute(Statement.java:130)
at TestFetchSize.main(TestFetchSize.java:22)
Unable to fathom update count MOVE

Cheers
Noel

> Noel,
>
> I don't know if this is your problem or not, but your test program is
> wrong. You should not be issuing a 'begin work' command in jdbc. The
> proper jdbc way of doing this is to: connection.setAutoCommit(false);
> ....; connection.commit();
>
> The driver behind the scenes is issuing the begin/commit/rollback
> commands. Calling them explicitly is redundant and will result in
> errors.
>
> thanks,
> --Barry
>
>
> Noel wrote:
>
>> Hi all,
>> I'm new to postgreSQL.
>> I wrote a little test program to learn how to use fetch and move in
>> postgreSQL.
>>
>> import blastDb.*;
>> import java.sql.*;
>> import java.io.*;
>> import java.util.*;
>> import java.lang.*;
>>
>> public class TestFetchSize
>> {
>> public static void main(String[] args)
>> {
>> try
>> {
>> BlastDB db = new BlastDB();
>> Statement stmt =db.connection.createStatement();
>> int counte = 0;
>> stmt.execute("begin work");
>> stmt.execute("declare test cursor for select id from
>> region where protein_database = 1");
>> ResultSet rs;
>> stmt.execute("move forward 99 in test");
>> while(stmt.execute("fetch forward 2000 in test"))
>> {
>> rs = stmt.getResultSet();
>> if (rs.next())
>> {
>> ++counte;
>> while (rs.next())
>> {
>> ++counte;
>> }
>> }
>> else
>> break;
>> }
>> System.out.println(counte);
>> stmt.execute("end work");
>> }
>> catch (Exception e)
>> {
>> e.printStackTrace();
>> System.out.println(e.getMessage());
>> }
>> }
>> }
>>
>> It compiles ok, however when run i get this message:
>> Unable to fathom update count MOVE
>> at
>> org.postgresql.core.QueryExecutor.receiveCommandStatus(QueryExecutor.java:182)
>>
>> at org.postgresql.core.QueryExecutor.execute(QueryExecutor.java:80)
>> at org.postgresql.Connection.ExecSQL(Connection.java:398)
>> at org.postgresql.jdbc2.Statement.execute(Statement.java:130)
>> at TestFetchSize.main(TestFetchSize.java:25)
>> Unable to fathom update count MOVE
>>
>> I've search the web and the archives, and the only thing close is the
>> thread about a sim problem with INSERT:
>> "Basically the driver was storing the oid in an int. The value you have
>> is overflowing the value allowed for a signed int.
>>
>> thanks,
>> --Barry "
>>
>> Is this the same problem ?
>> Using 7.4 divers with JDBC3 support.
>>
>> Cheers
>> Noel
>>
>>
>> ---------------------------(end of broadcast)---------------------------
>> TIP 4: Don't 'kill -9' the postmaster
>>
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 5: Have you checked our extensive FAQ?
>
> http://www.postgresql.org/users-lounge/docs/faq.html

In response to

Browse pgsql-jdbc by date

  From Date Subject
Next Message Noel 2002-12-20 00:48:15 Re: error when using move, any suggestions?
Previous Message Jeremy Buchmann 2002-12-20 00:17:40 Re: numrows