From: | Marc Herbert <Marc(dot)Herbert(at)continuent(dot)com> |
---|---|
To: | pgsql-jdbc(at)postgresql(dot)org |
Subject: | Re: Catching postgres exceptions - functions returning error values? |
Date: | 2006-08-30 16:27:40 |
Message-ID: | khjlkp6yyrn.fsf@meije.emic.fr |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-jdbc |
Mario Splivalo <mario(dot)splivalo(at)mobart(dot)hr> writes:
> Now, if the database server is unavailable, I get something like this:
>
> org.postgresql.util.PSQLException: Connection refused. Check that the
> hostname and port are correct and that the postmaster is accepting
> TCP/IP connections.
>
> I would like to know, in my code, what happened, and inform user
> apropriatley, I don't want just to print the exception to the user.
What would like to substitute to the above message for instance? Is
this just a language issue?
> I could parse the return from printStackTrace method, but that just
> doesn't seem right.
>
> Also, some of the functions need to return errorcode of some sort. If
> the function is returning SETOF, I can't use OUT parametars. So, I'm
> asking for a recomendation here.
Maybe you want to use the SQLState
http://www.postgresql.org/docs/8.1/interactive/errcodes-appendix.html
http://www.easysoft.com/developer/interfaces/odbc/sqlstate_status_return_codes.html
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/odbc/htm/odbcodbc_error_codes.asp
http://www.opengroup.org/bookstore/catalog/c451.htm (appendix A)
http://www.opengroup.org/bookstore/catalog/c449.htm (appendix B)
From | Date | Subject | |
---|---|---|---|
Next Message | Bruce Momjian | 2006-08-30 18:21:18 | Re: [HACKERS] [PATCHES] log_statement output for protocol |
Previous Message | meil parachorras | 2006-08-30 15:53:05 | Encoding Problem |