Subject | Catch Unique index Exception |
---|---|
Author | pkroiss |
Post date | 2004-04-29T13:58:57Z |
Wenn Catching a unique Index Exception like I've done to check for
a unique index constraint I've to check 335544349 instead of SQLCode -
803.
Nevertheless - It works but a Stracktrace is printed.
How can I avoid printing this Stacktrace
Thx, Peter
Code-Fragment:
} catch (SQLException dupValOnIndexEx) {
if (dupValOnIndexEx.getErrorCode() == 335544349) { // dup
Value
...
} else {
throw dupValOnIndexEx;
}
} finally {
....
}
Stacktrace
- ERROR: Thu Apr 29 15:42:39 CEST 2004, Thread[main,5,main]
SQLStatement executeQuery: [y99]Throwable:
org.firebirdsql.jdbc.FBSQLException
message: GDS Exception. attempt to store duplicate value (visible to
active transactions) in unique index "XPKPKTEST"
org.firebirdsql.jdbc.FBSQLException: GDS Exception. attempt to store
duplicate value (visible to active transactions) in unique
index "XPKPKTEST"
at org.firebirdsql.jdbc.FBPreparedStatement.internalExecute
(FBPreparedStatement.java:426)
at org.firebirdsql.jdbc.FBPreparedStatement.executeUpdate
(FBPreparedStatement.java:137)
a unique index constraint I've to check 335544349 instead of SQLCode -
803.
Nevertheless - It works but a Stracktrace is printed.
How can I avoid printing this Stacktrace
Thx, Peter
Code-Fragment:
} catch (SQLException dupValOnIndexEx) {
if (dupValOnIndexEx.getErrorCode() == 335544349) { // dup
Value
...
} else {
throw dupValOnIndexEx;
}
} finally {
....
}
Stacktrace
- ERROR: Thu Apr 29 15:42:39 CEST 2004, Thread[main,5,main]
SQLStatement executeQuery: [y99]Throwable:
org.firebirdsql.jdbc.FBSQLException
message: GDS Exception. attempt to store duplicate value (visible to
active transactions) in unique index "XPKPKTEST"
org.firebirdsql.jdbc.FBSQLException: GDS Exception. attempt to store
duplicate value (visible to active transactions) in unique
index "XPKPKTEST"
at org.firebirdsql.jdbc.FBPreparedStatement.internalExecute
(FBPreparedStatement.java:426)
at org.firebirdsql.jdbc.FBPreparedStatement.executeUpdate
(FBPreparedStatement.java:137)