Order VPS Hosting
Order a VPS, Semi- dedicated or Dedicated server in Dallas, London or Australia.

Get Assistance
Ask our support team about your hosting requirements.


Host where the staff takes pride in making customers happy

Thank you so much. I've feel like I've stumbled into an alternate universe with the support I've gotten in the short time I've been a customer. You guys are awesome.

- Kevin (a new customers, after we helped out setup a few things) (#21/312)
Home > Support > HOWTO List > Accessing Postgresql via JDBC

Accessing Postgresql via JDBC

For PostgreSQL 7.X, in /var/lib/pgsql/data/postgresql.conf set:

tcpip_socket = true

For PostgreSQL 8.X, see
http://www.postgresql.org/docs/8.1/static/runtime-config-connection.html#RUNTIME-CONFIG-CONNECTION-SETTINGS

This permits access to postgresql using sockets rather than Linux socket files.

In /var/lib/pgsql/data/pg_hba.conf, uncomment:

host    all         all         127.0.0.1         255.255.255.255   trust

This allows clients on the server to connect to the postgresql server.

The postgresql connection url is decribed at:
http://www.postgresql.org/docs/7.4/static/jdbc-use.html#JDBC-CONNECT.

For example: jdbc:postgresql://host:port/database (host defaults to localhost, port defaults to 5432).

A quick bit of code to test your connectivity would be something like:


Class.forName("org.postgresql.Driver");
Connection c = DriverManager.getConnection("jdbc:postgresql:dbname", "username", "password"); 
System.out.println("Connected OK");    
c.close();

Hosting

Why RimuHosting

RimuHosting