New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

not correct show problem of connection #594

Closed
ayanprog opened this Issue Jun 27, 2016 · 3 comments

Comments

Projects
None yet
3 participants
@ayanprog

ayanprog commented Jun 27, 2016

i have problem with connection to db, with driver, console show problem with encoding with UTF-8 to windows-1251, but problem was in pg_hba.conf, i don't add my ip to file, i spend a lot of time for find this problem, can you solve this problem, with correct show exception. Thx

IDE: Intelji Idea 16.1.1
ProgramLang: Groovy
java: 8u92

@davecramer

This comment has been minimized.

Member

davecramer commented Jun 27, 2016

Part of the problem here is that Groovy consumes the exceptions.

Can you show me your groovy code or a snippet and I'll have a look

Dave Cramer

On 27 June 2016 at 07:54, ayanprog notifications@github.com wrote:

i have problem with connection to db, with driver, console show problem
with encoding with UTF-8 to windows-1251, but problem was in pg_hba.conf, i
don't add my ip to file, i spend a lot of time for find this problem, can
you solve this problem, with correct show exception. Thx

IDE: Intelji Idea 16.1.1
ProgramLang: Groovy
java: 8u92


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
#594, or mute the thread
https://github.com/notifications/unsubscribe/AAYz9j44qHxGezh7rOf8njasb3LL-cQBks5qP7oLgaJpZM4I_BMF
.

@vlsi

This comment has been minimized.

Member

vlsi commented Jun 27, 2016

@davecramer , I think this is our well-known "backend does not send connection error in utf8" issue.

@vlsi vlsi added this to the 9.4.1210 milestone Aug 9, 2016

@vlsi vlsi self-assigned this Aug 9, 2016

vlsi added a commit to vlsi/pgjdbc that referenced this issue Aug 9, 2016

feat: show proper error message when connecting to non-UTF-8 database
When database runs other than UTF-8 encoding, pgjdbc cannot easily decode
error messages, since the backend sends just bytes.
Typically, the client_encoding is set to utf-8, however errors that happen
before authentication are still sent with server-default encoding, thus
they cause issues for pgjdbc.

Added several heuristics to cover basic languages and encodings.

The relevant hackers thread: https://www.postgresql.org/message-id/bd579724-86f7-615b-fce8-8073731eef97@2ndquadrant.com

fixes pgjdbc#594
fixes pgjdbc#165
@vlsi

This comment has been minimized.

Member

vlsi commented Aug 9, 2016

I've implemented a fix on top of #618.

Some examples:

pt_BR.ISO8859-1: org.postgresql.util.PSQLException: FATAL: banco de dados "tst" não existe (pgjdbc: autodetected server-encoding to be ISO8859_1, if the message is not readable, please check database logs and/or host, port, dbname, user, password, pg_hba.conf)

ru_RU.CP1251: org.postgresql.util.PSQLException: ВАЖНО: база данных "tst" не существует (pgjdbc: autodetected server-encoding to be Cp1251, if the message is not readable, please check database logs and/or host, port, dbname, user, password, pg_hba.conf)

ja_JP.eucJP: org.postgresql.util.PSQLException: FATAL: データベース"tst"は存在しません (pgjdbc: autodetected server-encoding to be EUC_JP, if the message is not readable, please check database logs and/or host, port, dbname, user, password, pg_hba.conf)

fr_BE.ISO8859-15: org.postgresql.util.PSQLException: FATAL: la base de données « tst » n'existe pas (pgjdbc: autodetected server-encoding to be ISO8859_1, if the message is not readable, please check database logs and/or host, port, dbname, user, password, pg_hba.conf)

Steps to reproduce:

  1. Download PostgreSQL sources
  2. ./configure --enable-nls --with-libs=/opt/local/lib --with-includes=/opt/local/include (use your libs/includes otherwise it might fail to find gettext and silently disable NLS support)
  3. make clean && make install
  4. I use the following script to recreate DB:
#!/bin/sh
LANGG=ru_RU.UTF-8
./bin/pg_ctl -D db -l logfile stop
rm -rf ./db

./bin/initdb -D db --locale=$LANGG --encoding=UTF-8
LANG=$LANGG ./bin/pg_ctl -D db -l logfile start

vlsi added a commit to vlsi/pgjdbc that referenced this issue Aug 9, 2016

feat: show proper error message when connecting to non-UTF-8 database
When database runs other than UTF-8 encoding, pgjdbc cannot easily decode
error messages, since the backend sends just bytes.
Typically, the client_encoding is set to utf-8, however errors that happen
before authentication are still sent with server-default encoding, thus
they cause issues for pgjdbc.

Added several heuristics to cover basic languages and encodings.

The relevant hackers thread: https://www.postgresql.org/message-id/bd579724-86f7-615b-fce8-8073731eef97@2ndquadrant.com

fixes pgjdbc#594
fixes pgjdbc#165

vlsi added a commit to vlsi/pgjdbc that referenced this issue Aug 9, 2016

feat: show proper error message when connecting to non-UTF-8 database
When database runs other than UTF-8 encoding, pgjdbc cannot easily decode
error messages, since the backend sends just bytes.
Typically, the client_encoding is set to utf-8, however errors that happen
before authentication are still sent with server-default encoding, thus
they cause issues for pgjdbc.

Added several heuristics to cover basic languages and encodings.

The relevant hackers thread: https://www.postgresql.org/message-id/bd579724-86f7-615b-fce8-8073731eef97@2ndquadrant.com

fixes pgjdbc#594
fixes pgjdbc#165

vlsi added a commit to vlsi/pgjdbc that referenced this issue Aug 10, 2016

feat: show proper error message when connecting to non-UTF-8 database
When database runs other than UTF-8 encoding, pgjdbc cannot easily decode
error messages, since the backend sends just bytes.
Typically, the client_encoding is set to utf-8, however errors that happen
before authentication are still sent with server-default encoding, thus
they cause issues for pgjdbc.

Added several heuristics to cover basic languages and encodings.

The relevant hackers thread: https://www.postgresql.org/message-id/bd579724-86f7-615b-fce8-8073731eef97@2ndquadrant.com

fixes pgjdbc#594
fixes pgjdbc#165

vlsi added a commit to vlsi/pgjdbc that referenced this issue Aug 10, 2016

feat: show proper error message when connecting to non-UTF-8 database
When database runs other than UTF-8 encoding, pgjdbc cannot easily decode
error messages, since the backend sends just bytes.
Typically, the client_encoding is set to utf-8, however errors that happen
before authentication are still sent with server-default encoding, thus
they cause issues for pgjdbc.

Added several heuristics to cover basic languages and encodings.

The relevant hackers thread: https://www.postgresql.org/message-id/bd579724-86f7-615b-fce8-8073731eef97@2ndquadrant.com

fixes pgjdbc#594
fixes pgjdbc#165

vlsi added a commit to vlsi/pgjdbc that referenced this issue Aug 10, 2016

feat: show proper error message when connecting to non-UTF-8 database
When database runs other than UTF-8 encoding, pgjdbc cannot easily decode
error messages, since the backend sends just bytes.
Typically, the client_encoding is set to utf-8, however errors that happen
before authentication are still sent with server-default encoding, thus
they cause issues for pgjdbc.

Added several heuristics to cover basic languages and encodings.

The relevant hackers thread: https://www.postgresql.org/message-id/bd579724-86f7-615b-fce8-8073731eef97@2ndquadrant.com

fixes pgjdbc#594
fixes pgjdbc#165

vlsi added a commit to vlsi/pgjdbc that referenced this issue Aug 10, 2016

feat: show proper error message when connecting to non-UTF-8 database
When database runs other than UTF-8 encoding, pgjdbc cannot easily decode
error messages, since the backend sends just bytes.
Typically, the client_encoding is set to utf-8, however errors that happen
before authentication are still sent with server-default encoding, thus
they cause issues for pgjdbc.

Added several heuristics to cover basic languages and encodings.

The relevant hackers thread: https://www.postgresql.org/message-id/bd579724-86f7-615b-fce8-8073731eef97@2ndquadrant.com

fixes pgjdbc#594
fixes pgjdbc#165

vlsi added a commit to vlsi/pgjdbc that referenced this issue Aug 11, 2016

feat: show proper error message when connecting to non-UTF-8 database
When database runs other than UTF-8 encoding, pgjdbc cannot easily decode
error messages, since the backend sends just bytes.
Typically, the client_encoding is set to utf-8, however errors that happen
before authentication are still sent with server-default encoding, thus
they cause issues for pgjdbc.

Added several heuristics to cover basic languages and encodings.

The relevant hackers thread: https://www.postgresql.org/message-id/bd579724-86f7-615b-fce8-8073731eef97@2ndquadrant.com

fixes pgjdbc#594
fixes pgjdbc#165

vlsi added a commit to vlsi/pgjdbc that referenced this issue Aug 11, 2016

feat: show proper error message when connecting to non-UTF-8 database
When database runs other than UTF-8 encoding, pgjdbc cannot easily decode
error messages, since the backend sends just bytes.
Typically, the client_encoding is set to utf-8, however errors that happen
before authentication are still sent with server-default encoding, thus
they cause issues for pgjdbc.

Added several heuristics to cover basic languages and encodings.

The relevant hackers thread: https://www.postgresql.org/message-id/bd579724-86f7-615b-fce8-8073731eef97@2ndquadrant.com

fixes pgjdbc#594
fixes pgjdbc#165

vlsi added a commit to vlsi/pgjdbc that referenced this issue Aug 11, 2016

feat: show proper error message when connecting to non-UTF-8 database
When database runs other than UTF-8 encoding, pgjdbc cannot easily decode
error messages, since the backend sends just bytes.
Typically, the client_encoding is set to utf-8, however errors that happen
before authentication are still sent with server-default encoding, thus
they cause issues for pgjdbc.

Added several heuristics to cover basic languages and encodings.

The relevant hackers thread: https://www.postgresql.org/message-id/bd579724-86f7-615b-fce8-8073731eef97@2ndquadrant.com

fixes pgjdbc#594
fixes pgjdbc#165

vlsi added a commit to vlsi/pgjdbc that referenced this issue Aug 11, 2016

feat: show proper error message when connecting to non-UTF-8 database
When database runs other than UTF-8 encoding, pgjdbc cannot easily decode
error messages, since the backend sends just bytes.
Typically, the client_encoding is set to utf-8, however errors that happen
before authentication are still sent with server-default encoding, thus
they cause issues for pgjdbc.

Added several heuristics to cover basic languages and encodings.

The relevant hackers thread: https://www.postgresql.org/message-id/bd579724-86f7-615b-fce8-8073731eef97@2ndquadrant.com

fixes pgjdbc#594
fixes pgjdbc#165

vlsi added a commit to vlsi/pgjdbc that referenced this issue Aug 11, 2016

feat: show proper error message when connecting to non-UTF-8 database
When database runs other than UTF-8 encoding, pgjdbc cannot easily decode
error messages, since the backend sends just bytes.
Typically, the client_encoding is set to utf-8, however errors that happen
before authentication are still sent with server-default encoding, thus
they cause issues for pgjdbc.

Added several heuristics to cover basic languages and encodings.

The relevant hackers thread: https://www.postgresql.org/message-id/bd579724-86f7-615b-fce8-8073731eef97@2ndquadrant.com

fixes pgjdbc#594
fixes pgjdbc#165

vlsi added a commit to vlsi/pgjdbc that referenced this issue Aug 11, 2016

feat: show proper error message when connecting to non-UTF-8 database
When database runs other than UTF-8 encoding, pgjdbc cannot easily decode
error messages, since the backend sends just bytes.
Typically, the client_encoding is set to utf-8, however errors that happen
before authentication are still sent with server-default encoding, thus
they cause issues for pgjdbc.

Added several heuristics to cover basic languages and encodings.

The relevant hackers thread: https://www.postgresql.org/message-id/bd579724-86f7-615b-fce8-8073731eef97@2ndquadrant.com

fixes pgjdbc#594
fixes pgjdbc#165

vlsi added a commit to vlsi/pgjdbc that referenced this issue Aug 12, 2016

feat: show proper error message when connecting to non-UTF-8 database
When database runs other than UTF-8 encoding, pgjdbc cannot easily decode
error messages, since the backend sends just bytes.
Typically, the client_encoding is set to utf-8, however errors that happen
before authentication are still sent with server-default encoding, thus
they cause issues for pgjdbc.

Added several heuristics to cover basic languages and encodings.

The relevant hackers thread: https://www.postgresql.org/message-id/bd579724-86f7-615b-fce8-8073731eef97@2ndquadrant.com

fixes pgjdbc#594
fixes pgjdbc#165

vlsi added a commit to vlsi/pgjdbc that referenced this issue Aug 12, 2016

feat: show proper error message when connecting to non-UTF-8 database
When database runs other than UTF-8 encoding, pgjdbc cannot easily decode
error messages, since the backend sends just bytes.
Typically, the client_encoding is set to utf-8, however errors that happen
before authentication are still sent with server-default encoding, thus
they cause issues for pgjdbc.

Added several heuristics to cover basic languages and encodings.

The relevant hackers thread: https://www.postgresql.org/message-id/bd579724-86f7-615b-fce8-8073731eef97@2ndquadrant.com

fixes pgjdbc#594
fixes pgjdbc#165

@vlsi vlsi closed this in ec5fb4f Aug 13, 2016

zemian pushed a commit to zemian/pgjdbc that referenced this issue Oct 6, 2016

feat: show proper error message when connecting to non-UTF-8 database
When database runs other than UTF-8 encoding, pgjdbc cannot easily decode
error messages, since the backend sends just bytes.
Typically, the client_encoding is set to utf-8, however errors that happen
before authentication are still sent with server-default encoding, thus
they cause issues for pgjdbc.

Added several heuristics to cover basic languages and encodings.

The relevant hackers thread: https://www.postgresql.org/message-id/bd579724-86f7-615b-fce8-8073731eef97@2ndquadrant.com

fixes pgjdbc#594
fixes pgjdbc#165
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment