How to disable Postgresql messages translation - postgresql

Is there a way to disable the Postgresql translation of messages? I´m running my appl and Postgresql on a pt_BR Windows machine and when a exception is thrown the error message is translated to Portuguese, like:
Caused by: org.postgresql.util.PSQLException: ERRO: relação "unidade_federacao" não existe
Posição: 25
I would like the messages to appear in English.
I´m using the driver postgresql-8.4-701.jdbc3.jar on a Java (with Hibernate) app.
thanks in advance,
Fabrício Lemos

You could change lc_messages in postgresql.conf or just per database:
ALTER DATABASE dbname SET lc_messages=en_us;
See also the manual.

Under Windows, some psql error messages are getting translated corresponding to the format setting in Windows settings -> Clock, Language, and Region -> Change location -> Formats -> Format.
To prevent a mix of translated and untranslated messages, I've set this format to "English (United States)".

execute the following query to your database in order to find the postgres.conf file which is loaded for the configuration:
SHOW config_file;
Edit your postgres.conf file with your prefered lc.... lc_messages,lc_numeric...etc.
i think you can change all with lc_ALL
example : lc_ALL=en_US.UTF-8
Finally execute the following command to reload conf.
SELECT pg_reload_conf();

Related

encoding error accessing postgresql from wildfly

just setting up new computer and I can't get my wildfly to connect to the postgres. I'm using same standalone.xml as on old computer.
The postgres database is configured to UTF8 (default). Usign pgadmin, I restored from backup and it shows german Umlaute correctly.
But when I start wildfly, I get following error:
Caused by: java.io.IOException: Ung³ltige UTF-8-Sequenz: das erste Byte ist 10xxxxxx: 187
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)
... 35 more
sorry for the german error message. I have no idea why this message is in german.
any ideas what could be wrong?
it turned out that there is an issue with parsing error messages coming with a different locale. Apparently the postgresql jdbc driver can only handle english error messages and there was an error.
Root cause: I made a spelling mistake for a table in the database. That caused Postgresql to throw an error. But it threw the error with a german error message. And the postgresql jdbc driver was unable to parse it and threw a new error as shown in the question.
I fixed the original spelling error and with the root cause gone, there was no more error message to parse.
a year later (now) I finally fixed the locale issue by editing the standalone.xml:
<datasource jndi-name="java:jboss/datasources/PostgresDS" ...>
...
<new-connection-sql>SET lc_messages TO 'en_US.UTF-8'</new-connection-sql>
...
</datasource>

Connection rejected: No connection character set specified (property lc_ctype, encoding, charSet or localEncoding)

When I try to connect to a Firebird database with dbeaver this error is shown:
Connection rejected: No connection character set specified (property lc_ctype, encoding, charSet or localEncoding). Please specify a connection character set (eg property charSet=utf-8) or consult the Jaybird documentation for more information
Edit Connection -> Driver properties -> Add new property
lc_ctype = .... (example WIN1252,UTF-8,UNICODE,...)
https://www.firebirdsql.org/file/community/ppts/fbcon11/FbCon2011-Charsets-Heymann.pdf
The error says you "Please specify a connection character set" - and that is what you have to do.
Open DBeaver configuration, find the connection string or how it is called in DBeaver, and add any one of the connection encoding parameters with the value you want to the connection URI you set in DBeaver.
See section 3.2 in the Jaybird FAQ:
Jaybird provides two connection properties to specify the connection
character set:
charSet with a Java character set name (alias: localEncoding)
The Java character set name must map to an equivalent Firebird character set.
encoding with a Firebird character set name (alias: encoding[sic, should be lc_ctype])
The Firebird character set name - with the exception of NONE must map to an equivalent Java character set.
For most applications, use only one of these two properties.
For the specifics of this error see section 3.2.3 in the FAQ.
I had to install a past jaybird.jar version 2.2.13 of driver connection of Firebird to fix this problem.

db2set codepage in not working in DB2 windows

I am using DB2 version 9.7 and 10.1 both.When i execute the command to change the code page like "db2set db2codepage=1250" it does not show any error. but aftre that when i import the data then it throws the following error
SQLCODE: -332 - SQLSTATE: 57017
*** SQL0332N Character conversion from the source code page "1252" to the target code page "1250" is not supported. SQLSTATE=57017
if the charset is utf-8 you should use DB2CODEPAGE=1208 on non-windows and 1252 on windows in the system and restart your application.

pycharm and postgres: ERROR: Unsupported startup parameter: extra_float_digits

Having issue to connect to PostgreSQL 9.0 database from PyCharm. I already tried adding older jdbc driver manually but still getting the same error: "ERROR: Unsupported startup parameter: extra_float_digits".
The "fix" is to add this to the config.ini under the [pgbouncer] section:
ignore_startup_parameters = extra_float_digits
Details here: https://github.com/Athou/commafeed/issues/559
I had this error using the PostgreSQL JDBC driver connecting to PgBouncer. The fix was to add the following to pgbouncer.ini (which was already in the file but commented out):
ignore_startup_parameters = extra_float_digits
(similar to the previous answer but different config file)

How can I connect vertica with JDBC?

I want to connect vertica with JDBC. But I got errors.
Here is my code :
....
Class.forName("com.vertica.jdbc.Driver");
....
connection= DriverManager.getConnection
(
"jdbc:vertica://192.168.2.116:5433/schema", "dbadmin", "pass123"
);
But I got this error(if I open the netbeans database section I got same error message. But I connect to vertica with client(Dbeaver)) :
ex = (java.sql.SQLException) java.sql.SQLException: [Vertica]No enum const class com.vertica.dsi.dataengine.utilities.MetadataSourceColumnTag.COLUMN_SİZE
How can I fix this?
So if you need jdbc client for vertica in netbeans or intellij use this vertica jdbc driver. It's the one that worked for me. (taken from dbvisuzlizer).
i think it is because of your locale. in this case turkish i guess.
COLUMN_SİZE has upper case i -> İ
it is verticas fault to use toUpper digressivly.
Vertica's connect string uses databasename, not schema name after the host:port. See the doc for details:
https://my.vertica.com/docs/CE/6.0.1/HTML/index.htm#1395.htm
Connection conn = DriverManager.getConnection(
"jdbc:vertica://VerticaHost:portNumber/databaseName",
"username", "password");
By default, users have a search path of "$user, public, v_catalog, v_monitor and v_internal", therefore, you can create and use a matching username to connect directly to the desired SCHEMA.
Its about 32 bit - 64 bit issue I think, because it is working on 32 bit windows I cant understand
make sure the connector (vertica-jdbc-xxxx.jar) is in the JDK\jre\lib\ext folder