From: | Jon Swinth <jswinth(at)atomicpc(dot)com> |
---|---|
To: | yysydney(at)yahoo(dot)com(dot)au |
Cc: | pgsql-jdbc(at)postgresql(dot)org |
Subject: | Re: PrimaryKeyExists Error |
Date: | 2003-02-18 18:37:32 |
Message-ID: | 200302181037.32382.jswinth@atomicpc.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-jdbc |
This is actually a PostgreSQL issue and not a JDBC issue. PostgreSQL
transactioning has a flaw in that once an exception is thrown the transaction
is aborted and you must call rollback before any further SQL. That is why
you are getting the message "current transaction is aborted, queries ignored
until end of transaction". Borland Appserver is probably calling some SQL
that results in an exception, catching the exception, and expecting to be
able to run a different SQL statement. This is very common, especially on
applications writting originally for Oracle. Unfortunately, this will not
work in PostgreSQL.
I have lobbied to have this changed, since this and the write locks taken by
foreign keys are the only two things keeping PostgreSQL from being able to be
used instead of Oracle on most every project I have ever done.
Unfortunately, there is still no concept of save points (internal or
external) in PostgreSQL so continuing after an exception is not possible.
Hope this helps explain things.
On Monday 17 February 2003 03:20 pm, pgsql-jdbc-owner(at)postgresql(dot)org wrote:
> Date: Mon, 17 Feb 2003 15:21:20 +1100 (EST)
> From: =?iso-8859-1?q?Yan=20Yan=20Che?= <yysydney(at)yahoo(dot)com(dot)au>
> To: pgsql-jdbc(at)postgresql(dot)org
> Subject: PrimaryKeyExists Error
> Message-ID: <20030217042120(dot)39469(dot)qmail(at)web11304(dot)mail(dot)yahoo(dot)com>
>
>
> Dear psql friends,
> I am trying to replace an Oracle Db by Postgresql.
> The problem is that I am using Borland Appserver
> application which talks to the oracle db. After i
> changed to a postgresql db, i re-imported the data
> schemas in JBuilder and changed the driver to jdbc.
> all are fine. but when i tried to insert into the db,
> tables with a single primary key field was inserted
> fine, but tables with composit primary keys reports a
> "primaryKeyExists" error like this:
>
>
> -- Calling
> create(Stub[repository_id=RMI:au.com.cybernetics.thinkplando.ejb.ActivityRe
>mote:000000000000 ...
>
>
> java.rmi.ServerException: java.rmi.ServerException:
> primaryKeyExists failed; nested exception is:
> java.sql.SQLException: ERROR: current transaction is
> aborted, queries ignored until end of transaction
> block
> ; nested exception is:
> java.sql.SQLException: ERROR: current transaction is
> aborted, queries ignored until end of transaction
> block
>
>
>
> java.sql.SQLException: ERROR: current transaction is
> aborted, queries ignored until end of transaction
> block
From | Date | Subject | |
---|---|---|---|
Next Message | Felipe Schnack | 2003-02-18 18:54:29 | 7.3.2 psql error! |
Previous Message | Felipe Schnack | 2003-02-18 17:59:37 | problem in preparedstatements |