pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
CachedRowSet insertion problem with serial PK
2+ messages / 2 participants
[nested] [flat]

* CachedRowSet insertion problem with serial PK
@ 2006-06-02 14:48  rcolmegna@tiscali.it <rcolmegna@tiscali.it>
  0 siblings, 1 reply; 2+ messages in thread

From: rcolmegna@tiscali.it @ 2006-06-02 14:48 UTC (permalink / raw)
  To: pgsql-jdbc

hi,

I'm tring postgresql-8.1-407.jdbc3.jar (with PG 7.4.3 srv) and 
CachedRowSet (Sun implementation).

I have a small test table: it has two fields: 
1) id  SERIAL NOT NULL PRIMARY KEY
2) info VARCHAR(100)


I try this java code:

    CachedRowSet rs;
    ...
    rs.setCommand("select id,info from a WHERE id<?");
    rs.setInt(1, 10);
    ...
    rs.moveToInsertRow();
    rs.setString(2, "zzzz2");
    rs.insertRow();

but I obtain this error:
"SQLException: Failed on insert row" (generated from the insertRow() 
line).

I sniffed the network-connection betweend DB-srv and JDBC-client, and 
I noted that
the INSERT instruction isn't fired against the DB.  If I ask if 
"isAutoIncrement(<id_idx>)"
I obtain a true reply.

Any idea?

TIA
Roberto Colmegna





		
La gara più entusiasmante dell'anno! 

Gioca e corri alla velocità della luce sui 18 circuiti di Intel Speed Contest 2006!

I più bravi vincono Notebook Sony VAIO, iPod da 60 GB e altro ancora... 

Sfida gli amici!

http://intelspeedcontest2006.tiscali.it/ 
	



^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: CachedRowSet insertion problem with serial PK
@ 2006-06-02 15:47  Oliver Jowett <oliver@opencloud.com>
  parent: rcolmegna@tiscali.it <rcolmegna@tiscali.it>
  0 siblings, 0 replies; 2+ messages in thread

From: Oliver Jowett @ 2006-06-02 15:47 UTC (permalink / raw)
  To: rcolmegna@tiscali.it <rcolmegna@tiscali.it>; +Cc: pgsql-jdbc

rcolmegna@tiscali.it wrote:

>     CachedRowSet rs;
>     ...
>     rs.setCommand("select id,info from a WHERE id<?");
>     rs.setInt(1, 10);
>     ...
>     rs.moveToInsertRow();
>     rs.setString(2, "zzzz2");
>     rs.insertRow();
> 
> but I obtain this error:
> "SQLException: Failed on insert row" (generated from the insertRow() 
> line).

Can you work out what the real exception thrown by the driver is? It is 
hard to diagnose this without knowing what is happening at the low-level 
JDBC API level.

-O



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2006-06-02 15:47 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2006-06-02 14:48 CachedRowSet insertion problem with serial PK rcolmegna@tiscali.it <rcolmegna@tiscali.it>
2006-06-02 15:47 ` Oliver Jowett <oliver@opencloud.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox