Re: Expressiveness of SQLException
| От | Daniel Migowski |
|---|---|
| Тема | Re: Expressiveness of SQLException |
| Дата | |
| Msg-id | 4810A1FD.3080103@ikoffice.de обсуждение исходный текст |
| Ответ на | Re: Expressiveness of SQLException (Oliver Jowett <oliver@opencloud.com>) |
| Ответы |
Re: Expressiveness of SQLException
|
| Список | pgsql-jdbc |
Thank you for your responses. Sadly, they don't help me (with PG 8.3 and
the JDBC-3-Driver).
This is my SQL:
CREATE OR REPLACE FUNCTION fail() RETURNS int4 AS
$BODY$ BEGIN RAISE exception 'FAIL'; return null; END; $BODY$ LANGUAGE
'plpgsql';
CREATE OR REPLACE FUNCTION fail2()RETURNS int4 AS
$BODY$ BEGIN select fail(); return null; END; $BODY$ LANGUAGE 'plpgsql';
select fail2();
And this the result:
ERROR: FAIL
SQL Status:P0001
Kontext:SQL statement "select fail()"
PL/pgSQL function "fail2" line 1 at SQL statement
Now when called from Java:
try {
ResultSet r = stmt.executeQuery("select fail2();");
JdbcUtils.dumpResultSet(r);
} catch (SQLException e) {
e.printStackTrace();
PSQLException ex = (PSQLException)e;
System.err.println(ex.getServerErrorMessage());
System.err.println(ex.getSQLState());
System.err.println(ex.getErrorCode());
System.err.println(ex.getNextException());
System.err.println(ex.getCause());
}
I get this result:
org.postgresql.util.PSQLException: ERROR: function fail2() does not exist
at
org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:1559)
at
org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1327)
at
org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:192)
at
org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:451)
at
org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:336)
at
org.postgresql.jdbc2.AbstractJdbc2Statement.executeQuery(AbstractJdbc2Statement.java:235)
at de.ikoffice.jdbc.JdbcExceptionsTest.main(JdbcExceptionsTest.java:24)
ERROR: function fail2() does not exist
42883
0
null
null
where is no more information from the functions you proposed. Is this a bug?
With best regards,
Daniel Migowski
В списке pgsql-jdbc по дате отправления: