What is the format for the PostgreSQL connection string (URL postgres://...
) when the host is not the localhost?
348
votes
This link provides information about connection string, driver class, and driver library. docs.oracle.com/cd/E19509-01/820-3497/agqka/index.html Also to download the recent jar files, use this link: jdbc.postgresql.org/download.html
– Lulu
6 Answers
572
votes
If you use Libpq binding for respective language, according to its documentation URI is formed as follows:
postgresql://[user[:password]@][netloc][:port][/dbname][?param1=value1&...]
Here are examples from same document
postgresql://
postgresql://localhost
postgresql://localhost:5432
postgresql://localhost/mydb
postgresql://user@localhost
postgresql://user:secret@localhost
postgresql://other@localhost/otherdb?connect_timeout=10&application_name=myapp
postgresql://localhost/mydb?user=other&password=secret
127
votes
23
votes
Here is the documentation for JDBC, the general URL is "jdbc:postgresql://host:port/database"
Chapter 3 here documents the ADO.NET connection string,
the general connection string is Server=host;Port=5432;User Id=username;Password=secret;Database=databasename;
PHP documentation us here, the general connection string is
host=hostname port=5432 dbname=databasename user=username password=secret
If you're using something else, you'll have to tell us.
5
votes