Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Connect to PostgreSQL from libreoffice base with SDBC

I'm trying to open a connection to a PostgreSQL database from LibreOffice with SDBC. After installing the "postrgre-sdbc-0.7.6" plugin, the "postgresql" datasource appears. The system asks for the datasource URL where I enter my IP

192.168.0.12

then my user name, ticks the "Password required" box, and after entering my password the "Test connection" button gives me the following error message.

A driver is not registered for the URL sdbc:postresql:192.168.0.12

I tried adding the port to the URL (192.168.0.12:5432), same error. As suggested I also rebooted both base and the computer, no luck either.

I know the server is running correctly as I access it no problem from pgAdminIII with these parameters.

As suggested by Richard, I also tried

host=192.168.0.12 port=5432 dbname=dataerp connect_timeout=10
host=192.168.0.12 port=5432 dbname=dataerp 
host=192.168.0.12 dbname=dataerp
dbname=dataerp host=192.168.0.12

also

//192.168.0.12/dataerp
//192.168.0.12:5432/dataerp
192.168.0.12:5432:dataerp
192.168.0.12:5432:dataerp:myusername:mypassword
192.168.0.12:5432=dataerp

Nothing works, I still get the same error message Any help welcome!


After investigations, I had installed the postgresql ODBC driver doing

sudo apt-get install odbc-postgresql

While what was needed was:

sudo apt-get install libreoffice-sdbc-postgresql

The correct connection syntax was

host=192.168.0.12 port=5432 dbname=dataerp 

Do not forget to reboot after this or it won't work! This tip was found here

like image 540
Pierre Avatar asked Oct 16 '25 10:10

Pierre


1 Answers

You don't want a raw IP address, you want a libpq connection string.

A quick google for "sdbc postgresql url" would give you the sdbc driver page which gives an example, and a link to the PostgreSQL docs.

In short you want a string something like

dbname=mydatabase host=192.168.0.12 or postgresql://localhost:5432/mydatabase

There are other options for port etc too - see the docs above in the "Connection Strings" section.

like image 169
Richard Huxton Avatar answered Oct 19 '25 00:10

Richard Huxton