Unix socket postgresql

Hi,

I have my PostgreSQL database running on a local unix socket:
config of my database:
unix_socket_directories = '/run/postgresql'

How do I connect jabref to this database? … as using /run/postgresql in the host/post field gives me the following error:

org.postgresql.util.PSQLException: Unable to parse URL jdbc:postgresql:///run/postgresql:5432/resources
	at org.jabref.merged.module@5.12.60000/org.postgresql.Driver.connect(Unknown Source)

Kind regards

Hm, I don’t know if we support this yet, from what I see Jabref tries to buidl the connection string as:
with host, port, database
jdbc:postgresql://%s:%d/%s

Therefore, you could try to percent-encode the host as the example from the docs

postgresql://%2Fvar%2Flib%2Fpostgresql/dbname 

Hmmm. I tried to fill into the host field:

%2Frun%2Fpostgresql

but it is not possible with the following error:

2024-05-17 23:19:34 [JavaFX Application Thread] org.jabref.logic.shared.DBMSConnection.<init>()
ERROR: Could not connect to database: The connection attempt failed. - Error code: 0

I guess I should make a request to fix this to accept /run/postgresql into the hostfield and not force a port,
or the possibility to add the whole jdbc string

Ah shit I see it’s the pattern we use which breaks it. I think an option for the whole jdbc string would also be a good idea.
“Expert configuration via JDBC string” as an additional option. This requires some more changes, but should be still doable. Will try to come up with something later or tomorrow

@bwakkie I came up with a solution which lets you specify the jdbc url (“enable expert mode” checkbox) and also now supports unix sockets through a factory:
You need to speficy the factory as parameter as well according to the docs
https://jdbc.postgresql.org/documentation/use/#unix-sockets
https://builds.jabref.org/pull/11303/merge

@bwakkie Have you had a chance to test the version?