UPDATE with JDBC fail - Mailing list pgsql-jdbc

From Jose.Silva@isotrol.com
Subject UPDATE with JDBC fail
Date
Msg-id 33339.192.168.102.86.1091701964.squirrel@192.168.102.86
Whole thread Raw
Responses Re: UPDATE with JDBC fail
Re: UPDATE with JDBC fail
Re: UPDATE with JDBC fail
List pgsql-jdbc
Hi, my name is J.A. Silva
I'm a worker of Isotrol (Spain).
I'm developing a tool for modify values in a PostGreSQL database.
The tool only have to modify some tables with a random value.

The code that do this is ...
private void refrescaTablaDatos()
{
    String sql = "";
    String molino;
    ResultSet rs = null;
    int i = 0;

    try
    {
        // select the primary keys of the items to modify
        sql = "SELECT DISTINCT id FROM datos;";
        rs = this.con.executeSQL(sql);

        // modify one per one all the items ...
        while(rs.next())
        {
            molino = rs.getString(1);

            sql = "UPDATE datos SET valor = " +
                   (float)(100*Math.random()) +
                ", timestamp = now() WHERE id = " +
                molino + ";";

            this.con.executeSQL(sql);
            i = i + this.con.getFilasAfectadas();
        }
    }
    catch(Exception e)
    {
        e.toString();
    }
}

The function is very simple ... but it does not work.
The database doen not change its values.

The select query works perfectly but the update funtion does not do anything.

I hope that you can help me. I will be expecting your answer.

The PosrGre version that I use is 7.1. and the JDBC driver that I use is
the driver that you can get of Postgre's webpage.

My english level is not good, I hope that you can understand this mail.

Thanks for all and good bye

pgsql-jdbc by date:

Previous
From: Ryoji Sawa
Date:
Subject: [Fwd: Q: database schema from JDBC driver and netbeans.]
Next
From: Kris Jurka
Date:
Subject: Re: UPDATE with JDBC fail