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