简体   繁体   English

使用 Spring 引导 Maven 的 PostgreSQL 的神秘数据库名称

[英]Cryptic Databasenames for PostgreSQL using Spring Boot Maven

On my PC I get the following error starting my Spring-Boot Server:在我的 PC 上,启动 Spring-Boot 服务器时出现以下错误:

org.postgresql.util.PSQLException: FATAL: Datenbank ╗Test½ existiert nicht (pgjdbc: autodetected server-encoding to be ISO-8859-1, if the message is not readable, please check database logs and/or host, port, dbname, user, password, pg_hba.conf)

(The first part is german and translates to "The Database does not exist") (第一部分是德语,翻译为“数据库不存在”)

In pgAdmin I created the Database "Test" and in my Application Properties I call the Database with spring.datasource.url=jdbc:postgresql://localhost:5432/Test在 pgAdmin 中,我创建了数据库“测试”,在我的应用程序属性中,我使用spring.datasource.url=jdbc:postgresql://localhost:5432/Test调用数据库

I think it may be an issue with encoding as it works on my laptop but I can not figure out a solution.我认为这可能是编码问题,因为它适用于我的笔记本电脑,但我无法找到解决方案。

For whatever reason Peter translates double quotes in error messages as » and « , so the English "Test" will become »Test« .无论出于何种原因,Peter 将错误消息中的双引号翻译为»« ,因此英文"Test"将变为»Test«

Now the client_encoding in your database session does not match your terminal's encoding, so the quotes look wrong.现在您数据库client_encoding中的 client_encoding 与您终端的编码不匹配,因此引号看起来不对。

I assume that you are on Windows, where the "shell" uses a different encoding than the rest of the system.我假设您使用的是 Windows,其中“shell”使用的编码与系统的 rest 不同。 Things will probably improve if you run the following in your cmd before starting your program:如果在启动程序之前在cmd中运行以下命令,情况可能会有所改善:

chcp 1252

At any rate, you need not worry about this.无论如何,您不必为此担心。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM