pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: davygora@sulzer.de
To: pgsql-bugs@postgresql.org
Subject: BUG #14166: JDBC driver won't parse error message from DB server in German
Date: Tue, 31 May 2016 14:32:13 +0000
Message-ID: <20160531143213.30388.89741@wrigleys.postgresql.org> (raw)
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>

The following bug has been logged on the website:

Bug reference:      14166
Logged by:          Yuriy Davygora
Email address:      davygora@sulzer.de
PostgreSQL version: 9.5.3
Operating system:   Windows 7 64 bit
Description:        

Prerequisites (all local, no remote servers):
  - PostgreSQL DB 9.5.3 with locale German_Germany.1252
  - PostgreSQL JDBC driver postgresql-9.4.1208.jar (jre8)
  - Payara JEE server 4.1.1.161.1
  - Oracle JDK 1.8.0_72
  - Misconfiguration of the JDBC connection in the domain.xml file causing
the DB connection error (see below)

The JDBC driver provides a property 'DatabaseName' which I set to the
correct database name which is different from the user name. Here is an
excerpt from domain.xml:

  <property name="DatabaseName" value="database_name"></property>
  <property name="User" value="user_name"></property>
  <property name="PortNumber" value="5432"></property>
  <property name="Url" value="jdbc:postgresql://localhost/"></property>

--------------------------
  
Bug description:

The DB connection error was "database does not exist" (which I found out
after switching the locale from German to English). To fix I had to include
the database name in the URL as follows:

  <property name="Url"
value="jdbc:postgresql://localhost/database_name?"></property>

While the locale of the DB server was still set to German, however, I did
get a different message. Here is an excerpt from the stacktrace:

Caused by: java.io.IOException: Ungültige UTF-8-Sequenz: das erste Byte ist
10xxxxxx: 132
	at org.postgresql.core.UTF8Encoding.decode(UTF8Encoding.java:104)
	at org.postgresql.core.PGStream.ReceiveString(PGStream.java:331)
	at
org.postgresql.core.v3.ConnectionFactoryImpl.readStartupMessages(ConnectionFactoryImpl.java:705)
	at
org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:213)
	... 90 more
]]

I downloaded the sources of the JDBC driver to find out where the error
comes from. It turned out, that the exception is thrown when the JDBC driver
cannot parse the error message from the DB server. Thus, I don't ever get to
see the original error message.

As mentioned above, setting the locale to English allowed me to see the
error and fix it quickly. However, it would be nice, if the error messages
could be parsed in any language.

--------------------------

P.S. This has nothing to do with the reported bug, however it might be a bug
in its own right. While the configuration was still as shown in the
prerequisites section, occasionally the JDBC connection would work, about
30% of the time, on a seemingly random basis.


-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs


view thread (5+ messages)  latest in thread

Message-ID: <20160531143213.30388.89741@wrigleys.postgresql.org>
Permalink:  ../20160531143213.30388.89741@wrigleys.postgresql.org/
Also on:    postgresql.org/message-id/20160531143213.30388.89741@wrigleys.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-jdbc@postgresql.org
  Cc: davygora@sulzer.de, pgsql-bugs@postgresql.org
  Subject: Re: BUG #14166: JDBC driver won't parse error message from DB server in German
  In-Reply-To: <20160531143213.30388.89741@wrigleys.postgresql.org>
  References: <20160531143213.30388.89741@wrigleys.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox