how to connect to postgresql table from libreoffice

Created by marcobra (Marco Braida) on on 2012-12-12
Keywords:
postgresql libreoffice connection datasource sdbc
Last updated by:
marcobra (Marco Braida) on on 2012-12-17

Assuming:

- we have a postgresql server configured (it need some configuration steps) and running in our lan with ip 192.168.1.58 listen on 5432 port for incoming connections.

- the server is also resolved on our lan as pgsqlserver.mydomain.com

- we have a defined user on db: "myuser" with password "mypassword"

- the remote database name to access to is: "postgresql_remote_db"

** First we must check/install the libreoffice-sdbc-postgresql package

sudo apt-get install libreoffice-sdbc-postgresql

------------------
We can create a datasource inside libreoffice to access to a rdbms database of the postgresql server

We can open the Libreoffice Base select new database from main menu
the we can link to an existent database select Postgresql database, into connection url you can specify some connection parameters put something like this:

dbname=postgresql_remote_db hostaddr=192.168.1.58 port=5432

or we can also set the user or user and password into connection string:

dbname=postgresql_remote_db hostaddr=192.168.1.58 port=5432 user=myuser password=mypassword

if instead of ipname we have a pc name the string will be something like this:

dbname=postgresql_remote_db host=pgsqlserver port=5432 user=myuser password=mypassword

Connections parameters details here: http://www.postgresql.org/docs/7.3/static/libpq-connect.html

Take care of security please consider:
http://www.postgresql.org/docs/8.2/static/ssh-tunnels.html
http://www.postgresql.org/docs/9.1/static/ssl-tcp.html