2010-08-27 14 views
61

Come si forma l'url di connessione Postgres, quando l'host è un altro computer rispetto all'host locale?Postgres Connection url

Ho permesso a Postgres di accettare richieste dall'esterno.

+0

Driver? Linguaggio? –

risposta

11

Here è la documentazione per JDBC, l'URL generale è "jdbc: postgresql: // host: port/database"

Capitolo 3 here documenta la stringa di connessione ADO.NET, la stringa di connessione generale è Server=host;Port=5432;User Id=username;Password=secret;Database=databasename;

documentazione di PHP noi here, la stringa di connessione generale è host=hostname port=5432 dbname=databasename user=username password=secret

Se stai usando qualcosa di diverso, dovrete dirci.

0

l'host o il nome host è l'indirizzo i.p del server remoto o se è possibile accedervi tramite la rete in base al nome del computer, che dovrebbe funzionare.

129

Se si utilizza vincolante libpq per rispettiva lingua, secondo il suo documentation URI è formato come segue:

postgresql://[user[:password]@][netloc][:port][/dbname][?param1=value1&...] 

Ecco alcuni esempi dal medesimo documento

postgresql:// 
postgresql://localhost 
postgresql://localhost:5433 
postgresql://localhost/mydb 
postgresql://[email protected] 
postgresql://user:[email protected] 
postgresql://[email protected]/otherdb?connect_timeout=10&application_name=myapp 
postgresql://localhost/mydb?user=other&password=secret 
+1

Questo ha funzionato per me postgres: // utente: secret @ localhost: 5432/mydatabasename –

0

l'url di connessione per Postgres sintassi :

"Server=host ipaddress;Port=5432;Database=dbname;User Id=userid;Password=password; 

esempio:

"Server=192.168.1.163;Port=5432;Database=postgres;User Id=postgres;Password=root;