Обсуждение: Updateable ResultSet
hi,
I have a Java application that inserts data (using jdbc) in the database with
methods similar to the ones below.
These methods function in MS Access 2000 and MySQL and now I am trying to
port this application to use PostgreSQL.
In PostgreSQL get the error "This resultSet is not updateable."
Any advice on how to solve this?
regards
Kaarle Kaila
-----------------
Connection con =
DriverManager.getConnection("jdbc:postgresql:kalle","kalle","");
Statement stmt = con.createStatement();
String sql = "create table koe (num int primary key,nimi
varchar(255))";
int resu = stmt.executeUpdate(sql);
sql = "insert into koe (num,nimi) values(1,'Kalle')";
resu = stmt.executeUpdate(sql);
sql = "select * from koe where num is null";
ResultSet rs = stmt.executeQuery(sql);
// above command functions OK
rs.moveToInsertRow();
rs.updateInt("num",2);
rs.updateString("nimi","Rita");
rs.insertRow();
// above commands fail in postgreSQL but are OK in other databases
stmt.close();
con.close();
--
Kaarle Kaila
mailto:kaarle.kaila@iki.fi
http://www.iki.fi/kaila
tel: 050 3725844
Only the dev driver supports updateable result sets
Dave
On Sat, 2002-08-17 at 13:07, Kaarle Kaila wrote:
> hi,
>
> I have a Java application that inserts data (using jdbc) in the database with
> methods similar to the ones below.
>
> These methods function in MS Access 2000 and MySQL and now I am trying to
> port this application to use PostgreSQL.
>
> In PostgreSQL get the error "This resultSet is not updateable."
>
> Any advice on how to solve this?
>
> regards
> Kaarle Kaila
> -----------------
>
> Connection con =
> DriverManager.getConnection("jdbc:postgresql:kalle","kalle","");
> Statement stmt = con.createStatement();
> String sql = "create table koe (num int primary key,nimi
> varchar(255))";
> int resu = stmt.executeUpdate(sql);
>
> sql = "insert into koe (num,nimi) values(1,'Kalle')";
> resu = stmt.executeUpdate(sql);
> sql = "select * from koe where num is null";
> ResultSet rs = stmt.executeQuery(sql);
> // above command functions OK
> rs.moveToInsertRow();
> rs.updateInt("num",2);
> rs.updateString("nimi","Rita");
> rs.insertRow();
> // above commands fail in postgreSQL but are OK in other databases
>
> stmt.close();
> con.close();
>
>
>
>
> --
> Kaarle Kaila
> mailto:kaarle.kaila@iki.fi
> http://www.iki.fi/kaila
> tel: 050 3725844
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Don't 'kill -9' the postmaster
>
>
On Saturday 17 August 2002 20:16, Dave Cramer wrote: > Only the dev driver supports updateable result sets > > Dave > I tried to find a dev jdbc driver but I only seem to find this one that I am using already: http://www.ca.postgresql.org/ftpsite/binary/v7.2.1/RPMS/redhat-7.2/postgresql-jdbc-7.2.1-2PGDG.i386.rpm Any advice on how to locate the dev driver? regards Kaarle -- Kaarle Kaila mailto:kaarle.kaila@iki.fi http://www.iki.fi/kaila tel: 050 3725844