UPDATE with JDBC fail

From: Jose(dot)Silva(at)isotrol(dot)com
To: pgsql-jdbc(at)postgresql(dot)org
Subject: UPDATE with JDBC fail
Date: 2004-08-05 10:32:44
Message-ID: 33339.192.168.102.86.1091701964.squirrel@192.168.102.86
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Kris Jurka 2004-08-05 14:19:19 Re: UPDATE with JDBC fail
Previous Message Ryoji Sawa 2004-08-05 10:00:13 [Fwd: Q: database schema from JDBC driver and netbeans.]