Re: Error Code [Viruschecked] - Mailing list pgsql-jdbc

From Patric Bechtel
Subject Re: Error Code [Viruschecked]
Date
Msg-id 20030117071633.DFE5F47633D@postgresql.org
Whole thread Raw
In response to Re: Error Code  ("Henry D." <user1@fictionary.org>)
List pgsql-jdbc
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Thu, 16 Jan 2003 20:04:37 -0800, Henry D. wrote:

I fear that you have to wait a bit longer for that change in the backend; as far
as I followed the discussion, it was "expected behaviour" NOT to continue the
transaction on ANY fault.
I can truly imagine that this change would open a can of worms inside the
backend... it's such a feature which would be rarely used, as even if PGSQL
would support it, I wouldn't use it :-) I want my transaction commit completely
clean...

tia
Patric


>Henry Danis wrote:
>It was my understanding from asking this question last year that while you could conceivably modify the JDBC driver to
translatethe Postgresql 
>error messages into meaningful codes or exception, that you couldn't cause the backend to "NOT" close the connection
onthings that shouldn't be 
>truly fatal errors.

>For example, in DB2 or Oracle if you do an insert into a table that causes a duplicate unique key situation you get an
error(sqlcode -803) that 
>while fatal for the insert doesn't cause the current transaction to rollback or the current connection to close.
That'sthe best possible behavior 
>because you may want to handle the error and rewrite the row with a changed key value.

>Any thoughts on solving this sort of an issue -- or is the answer -- keep waiting on changes to the backend?

>Thanks,
>Henry

>Patric Bechtel wrote:

>> -----BEGIN PGP SIGNED MESSAGE-----
>> Hash: SHA1
>>
>> On 16 Jan 2003 18:14:32 -0200, Daniel Serodio wrote:
>>
>> You could alter (read: contribute) the JDBC driver with the possibility
>> of giving back the error-Strings which themselves are the way the
>> driver handles the messages before localizing them himself.
>> For example: the driver detects a "connection refused" error himself.
>> He now issues a
>> throw new PSQLException ("postgresql.con.refused");
>> Inside the PSQLException, this string is translated via some property
>> files in the /org/postgresql directory of the jar.
>> Inside this directory, there are some files named
>> "errors.properties", or "errors_de.properties" etc which have lines like
>>
>> postgresql.con.refused:Connection refused. Check that the hostname and port are correct and that the postmaster is
acceptingTCP/IP connections. 
>> or
>> postgresql.con.refused:Verbindung verweigert. Prüfen Sie, daß der Server TCP/IP-Verbindungen annimmt.
>>
>> inside which is the error message of the driver.
>> It would be simple to patch PSQLException a bit to conserve the
>> error strings inside it and give them out to your "custom" translator, which
>> could make more "understandable" (for the non techie type of user)
>> error messages.
>>
>> just my 0.02¬... :-)
>>
>> Patric
>>
>> >Not the driver's fault, the backend doesn't implement error codes. You
>> >should customize the error messages based on the exception's
>> >getMessage().
>>
>> >[]'s
>> >Daniel Serodio
>>
>> >On Thu, 2003-01-16 at 17:31, Isaías Cristiano Barroso wrote:
>> >> Hi All,
>> >>
>> >> Possible is get a error code when a SQLException occurr?
>> >> I utilize getErrorCode(), but this don't work, always return zero.
>> >> I need this to customize the error message for the users of my system.
>> >>
>> >> Driver JDBC : pg73jdbc3.jar
>> >>
>> >> Thanks
>> >>
>> >> Isaias
>> >--
>> >Daniel Serodio <daniel@checkforte.com.br>
>> >CheckForte
>>
>> >---------------------------(end of broadcast)---------------------------
>> >TIP 2: you can get off all lists at once with the unregister command
>> >    (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)
>>
>> PGP Public Key Fingerprint: 2636 F26E F523 7D62  4377 D206 7C68 06BB
>>
>> - -----BEGIN PGP PUBLIC KEY BLOCK-----
>> Version: PGPsdk version 1.7.1 (C) 1997-1999 Network Associates, Inc. and its affiliated companies.
>>
>> mQGiBD4hkMERBADNMNrmye5hXtCU35gi5JB1IHkGuvgL/5BYkQpTyDLFA1rcHlUu
>> +lyCuQnaMBvqKXSbuwDymIOinbR/DFgRt7ZwWhlBZX9JCV2zcNbca2pJ9JFbrZ14
>> aTve0LWoO3ljZQz1g6dhC14D+a0vN3hDBvaxavgNeVIX5XJRKC02xlWhaQCg/0j0
>> S8/bNgKsbMSMVfAbeVrwGW0EALBiel6TNkKtO+8v2qMNvwR6AlGFPVgxX6B95xqC
>> RQlUDMKqd07Kfmub9qK7wX7n/c7ck96aSWsHkd+qXiX5wOrEUuVHUaR+OWQ772Gd
>> xzeJ1hgqEXNnUqwW8QnDGuK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gbC5I4Oaz6vDaAJ68hk3vKauoBcbjiISlUxqvul5M
>> tgb9kgcGDp9OiQBGBBgRAgAGBQI+IZDBAAoJEHxoBrvMu8qQly4Anjxp+O42ax91
>> dHIlZI93a3IYqjbZAJwJfDajIDVHHozMu8j5FEyV26WUEg==
>> =HZnf
>> - -----END PGP PUBLIC KEY BLOCK-----
>>
>> PGP Public Key Fingerprint: 2636 F26E F523 7D62  4377 D206 7C68 06BB
>>
>> -----BEGIN PGP SIGNATURE-----
>> Version: PGPsdk version 1.7.1 (C) 1997-1999 Network Associates, Inc. and its affiliated companies.
>>
>> iQA/AwUBPicZFXxoBrvMu8qQEQJ4swCeIw+FCpK4MKI4paPsGtG+7pTmgvEAoLgA
>> Dry2WeVmKF7YpEtdfRKrMdk8
>> =jiaJ
>> -----END PGP SIGNATURE-----
>>
>> ---------------------------(end of broadcast)---------------------------
>> TIP 2: you can get off all lists at once with the unregister command
>>     (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)


>---------------------------(end of broadcast)---------------------------
>TIP 4: Don't 'kill -9' the postmaster




- -----BEGIN PGP PUBLIC KEY BLOCK-----
Version: PGPsdk version 1.7.1 (C) 1997-1999 Network Associates, Inc. and its affiliated companies.

mQGiBD4hkMERBADNMNrmye5hXtCU35gi5JB1IHkGuvgL/5BYkQpTyDLFA1rcHlUu
+lyCuQnaMBvqKXSbuwDymIOinbR/DFgRt7ZwWhlBZX9JCV2zcNbca2pJ9JFbrZ14
aTve0LWoO3ljZQz1g6dhC14D+a0vN3hDBvaxavgNeVIX5XJRKC02xlWhaQCg/0j0
S8/bNgKsbMSMVfAbeVrwGW0EALBiel6TNkKtO+8v2qMNvwR6AlGFPVgxX6B95xqC
RQlUDMKqd07Kfmub9qK7wX7n/c7ck96aSWsHkd+qXiX5wOrEUuVHUaR+OWQ772Gd
xzeJ1hgqEXNnUqwW8QnDGuKjJ3WwvbfULlyOVI2WnJKBJb9dMheiWFaloTOqJ5LU
y3feA/9i/Pd3QPgBOudu7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+O42ax91
dHIlZI93a3IYqjbZAJwJfDajIDVHHozMu8j5FEyV26WUEg==
=HZnf
- -----END PGP PUBLIC KEY BLOCK-----


PGP Public Key Fingerprint: 2636 F26E F523 7D62  4377 D206 7C68 06BB

-----BEGIN PGP SIGNATURE-----
Version: PGPsdk version 1.7.1 (C) 1997-1999 Network Associates, Inc. and its affiliated companies.

iQA/AwUBPiefunxoBrvMu8qQEQJWAQCg3frHGyMVJIYLhI7hYvmIZrDtAEoAoPzQ
3yDU2XKcfUeEmsEir7l2VNMb
=PO5z
-----END PGP SIGNATURE-----





pgsql-jdbc by date:

Previous
From: "Henry D."
Date:
Subject: Re: Error Code
Next
From: "Vitali Petrov"
Date:
Subject: No results were returned by the query.