如何使用 LibreOffice Base 连接到 PostgreSQL 服务器?

bwD*_*aco 18 postgresql libreoffice-base

当我尝试使用 LibreOffice Base 3.5 连接到本地计算机上的 PostgreSQL 服务器时遇到错误(这也适用于 LibreOffice 4):

LibreOffice Base 数据源选择

以下语法 ( localhost:5432=<database name>; 数据库名称worktime) 不起作用:

在此处输入图片说明

当我尝试在下一页测试连接时,出现以下错误:

数据库 URL 错误 'sdbc:postgresql:localhost:5432=localhost':
无效的连接选项“localhost:5432”

数据源 URL 的正确语法是什么?

小智 16

Ever Forward 将回答您的问题:

这不是 Internet URL,但其功能类似。您现在需要告诉 LibreOffice 连接到特定计算机上的特定数据库:

dbname=mydb host=localhost

在 dbname 部分使用您的数据库名称。我使用 localhost 作为主机部分,因为 PostgreSQL 在同一台计算机上,但如果我想从远程计算机连接,我需要更改它。


Pau*_*ulb 14

我知道这个问题得到了回答......但这里有更多数据信息,供可能偶然发现此主题的人使用。

另一种形式的数据源 URL 的格式为:

dbname=postgres hostaddr=127.0.0.1 port=5433 user=db_user password=libreoffice
Run Code Online (Sandbox Code Playgroud)

我需要上面的,因为 LibreBase 使用的默认端口是 5432,但我需要 5433。

此 URL 格式在http://ask.libreoffice.org/question/459/generic-form-of-url-for-postgresql/ 中讨论