X-Original-To: pgsql-jdbc-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 05E2052ADD for ; Wed, 27 Jul 2005 16:41:18 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 42627-10 for ; Wed, 27 Jul 2005 19:41:09 +0000 (GMT) Received: from smtp-1.hut.fi (smtp-1.hut.fi [130.233.228.91]) by svr1.postgresql.org (Postfix) with ESMTP id 7BF2452ABC for ; Wed, 27 Jul 2005 16:41:07 -0300 (ADT) Received: from localhost (putosiko.hut.fi [130.233.228.114]) by smtp-1.hut.fi (8.12.10/8.12.10) with ESMTP id j6RJf6ik019234; Wed, 27 Jul 2005 22:41:06 +0300 Received: from smtp-1.hut.fi ([130.233.228.91]) by localhost (putosiko.hut.fi [130.233.228.114]) (amavisd-new, port 10024) with LMTP id 00649-56; Wed, 27 Jul 2005 22:41:05 +0300 (EEST) Received: from kosh.hut.fi (kosh.hut.fi [130.233.228.10]) by smtp-1.hut.fi (8.12.10/8.12.10) with ESMTP id j6RJeqkV019209; Wed, 27 Jul 2005 22:40:52 +0300 Date: Wed, 27 Jul 2005 22:40:52 +0300 (EEST) From: Heikki Linnakangas X-X-Sender: hlinnaka@kosh.hut.fi To: Michael Allman Cc: pgsql-jdbc@postgresql.org Subject: Re: jdbc xa patches In-Reply-To: <20050727005909.W74424@yvyyl> Message-ID: References: <20050726193540.M74424@yvyyl> <42E6D231.8090002@opencloud.com> <20050726225605.T74424@yvyyl> <42E70E8E.9010408@opencloud.com> <20050727005909.W74424@yvyyl> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-TKK-Virus-Scanned: by amavisd-new-2.1.2-hutcc at putosiko.hut.fi X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.002 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200507/373 X-Sequence-Number: 13521 On Wed, 27 Jul 2005, Michael Allman wrote: > Anyway, I'm counting on Postgres users knowing what they're doing, esp. with > something as non-trivial as XA support. We all know it's non-trivial, but it looks very innocent to the casual user who just registers two data sources to an application server. He doesn't see all the transaction managers and two-phase commits involved. To him it indeed looks trivial. Keeping that in mind, I think it's very important to give helpful error messages that actually give you a clue what the problem is. That means for example, that if the server version is too old to use two-phase commit, the error message should say "Your server version is too old for two-phase commit", not "Error executing statement PREPARE TRANSACTION 12343242". As pointed out elsewhere in this thread, you can set both the error code and the error message, just not directly in the XAException constructor. How about a little helper method to keep the rest of the code clean: private static constructXAException(int errcode, String message) { XAException ex = new XAException(message); ex.errorCode = errcode; return ex; } - Heikki