Received: from maia.hub.org (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id B5B3F634706 for ; Wed, 17 Jun 2009 17:37:52 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 58107-08 for ; Wed, 17 Jun 2009 17:37:51 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-qy0-f195.google.com (mail-qy0-f195.google.com [209.85.221.195]) by mail.postgresql.org (Postfix) with ESMTP id 6D45A6344BD for ; Wed, 17 Jun 2009 17:37:51 -0300 (ADT) Received: by qyk33 with SMTP id 33so746952qyk.15 for ; Wed, 17 Jun 2009 13:37:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=cQUnVvP6WK5GDx+ER3Bk9q3n5JCaOMvdnpbngxR/VpI=; b=cN6dL6apLrTOlhG57uWlh+L78aj136b3Ax8YzjxRhw+IpnZeGIvVa7i48QErrZybkk CSs9DmOL4si7vwD3ccqQqfUcOCVqT0Qq5ihv1JzUAigTxJ1+FB8XfxolPmxIvvZ147SA Hl5OtdAAxlKXPiQAKZjDDqCUStQIz0XQHQhoc= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=ayDTeqCf94icC6HfrFu9tVMgAH9sRaG6/e5rTw9tyA/P4svT+KJ5EHPWt0I1E5dugm m+bVZpKDH1Pq9BLoydhgMyBFWZRAhhq0d8LZqMJgC0rnAs46K2FzRMv9f3mc4DalFC8o 7aevdfAH+KTRPxW4u5kxgaYELWg/P51AM+wWo= MIME-Version: 1.0 Received: by 10.220.77.17 with SMTP id e17mr904157vck.47.1245271069742; Wed, 17 Jun 2009 13:37:49 -0700 (PDT) In-Reply-To: <226a19190906171304n2b306a0ufc676ad7be76b0e1@mail.gmail.com> References: <226a19190906171304n2b306a0ufc676ad7be76b0e1@mail.gmail.com> Date: Wed, 17 Jun 2009 13:37:49 -0700 Message-ID: Subject: Re: Please help! - Constraints Exception From: Ivan Bojer To: Dennis Brakhane Cc: pgsql-jdbc@postgresql.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests=none X-Spam-Level: X-Archive-Number: 200906/70 X-Sequence-Number: 19734 FYI I figured what was the problem. The database log level was changed to FATAL from ERROR (default?). On Wed, Jun 17, 2009 at 1:04 PM, Dennis Brakhane wrote: > On Wed, Jun 17, 2009 at 9:57 PM, Ivan Bojer wrote: >> I have a table with UNIQUE constraint on the column. Inserting 2 of >> same values on it fails (as it should) >> and I can see DBLog Error message. Alas, there is no exception thrown >> from JDBC so that I can properly >> handle it. > > This is from memory, so if I talk nonsense, I hope somebody corrects me. > > The exception thrown should be a SQLException. These have a > "getSQLState" method which returns a string. If this string is > "23505", you have a UNIQUE violation. > > You can see the possible error codes here: > > http://www.postgresql.org/docs/8.3/static/errcodes-appendix.html >