Thread: How to get rid of NOTICE:
Dear All, Using pg 7.3.4, Sun jvm 1.4.1_02 and either pg73jdbc3.jar or pg73jdbc2.jar on Linux Debian Woody I experiencing some problems when creating a table via JDBC. This statement: CREATE TABLE testtable( cd_id serial NOT NULL PRIMARY KEY, cd_structure BYTEA NOT NULL, cd_smiles VARCHAR(1000) NULL, cd_formula VARCHAR(100) NULL, cd_molweight float8 NULL, cd_fp1 int4 NOT NULL ); works fine from rsql, but using JDBC I will have an error: java.sql.SQLException: ERROR: current transaction is aborted, queries ignored until end of transaction block at org.postgresql.core.QueryExecutor.execute(QueryExecutor.java:131) As far as I can see, it is because when creating the table a NOTICE will be printed like: NOTICE: CREATE TABLE will create implicit sequence 'asdasd_cd_id_seq' for SERIAL column 'asdasd.cd_id' NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index 'asdasd_pkey' for table 'asdasd' that is interpreted as an exception in JDBC. Is there a way to get rid of this? Cheers: Szilva
NOTICEs are treated as SQLWarnings by the jdbc driver. Generally this error means that you had a previous error and tried continuing to use that connection without first calling rollback() on the connection. Do you have logic that traps SQLExceptions and then continues without doing a rollback() first? --Barry szilva@computer.org wrote: > Dear All, > > Using pg 7.3.4, Sun jvm 1.4.1_02 and either pg73jdbc3.jar or > pg73jdbc2.jar on Linux Debian Woody I experiencing some problems when > creating a table via JDBC. > > This statement: CREATE TABLE testtable( > cd_id serial NOT NULL PRIMARY KEY, > cd_structure BYTEA NOT NULL, > cd_smiles VARCHAR(1000) NULL, > cd_formula VARCHAR(100) NULL, > cd_molweight float8 NULL, > cd_fp1 int4 NOT NULL > ); > > works fine from rsql, but using JDBC I will have an error: > > java.sql.SQLException: ERROR: current transaction is aborted, queries > ignored until end of transaction block > at org.postgresql.core.QueryExecutor.execute(QueryExecutor.java:131) > > As far as I can see, it is because when creating the table a NOTICE will > be printed like: > > NOTICE: CREATE TABLE will create implicit sequence 'asdasd_cd_id_seq' for > SERIAL column 'asdasd.cd_id' > NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index > 'asdasd_pkey' for table 'asdasd' > > that is interpreted as an exception in JDBC. Is there a way to get rid of > this? > > Cheers: > Szilva > > ---------------------------(end of broadcast)--------------------------- > TIP 2: you can get off all lists at once with the unregister command > (send "unregister YourEmailAddressHere" to majordomo@postgresql.org) >