Thread: Accessing PG DB using jdbc
Hi all,
I am trying to set up postgres for my latest project and have tested the db locally using the postgre jdbc driver. What i was planning on doin was to try to access the postgres server remotely as in the production env, the db might reside on a different machine. Could someone guide me to how i should go about doin this. Also, i would like to find out the set up for similar situation on tomcat.
All help will be appreciated.
Thanks
Assuming the authorization is already set up on the remote machine, you can just add the hostname to your URL in this format: jdbc:postgresql://host/database If you are making the connection from your servlets in the Tomcat environment then the same method works (Just make sure the "web" user also has access to the database.) I believe there is also a way to set up a datasource in current versions of Tomcat, but I don't know how to do it via that method. Here are a couple of FAQs that might be helpful: http://www.fankhausers.com/postgresql/jdbc/ http://www.fankhausers.com/tomcat/jdbc/ -Nick -----Original Message----- From: pgsql-jdbc-owner@postgresql.org [mailto:pgsql-jdbc-owner@postgresql.org]On Behalf Of Gupta, Sahil Sent: Friday, November 07, 2003 12:42 PM To: 'pgsql-jdbc@postgresql.org' Subject: [JDBC] Accessing PG DB using jdbc Hi all, I am trying to set up postgres for my latest project and have tested the db locally using the postgre jdbc driver. What i was planning on doin was to try to access the postgres server remotely as in the production env, the db might reside on a different machine. Could someone guide me to how i should go about doin this. Also, i would like to find out the set up for similar situation on tomcat. All help will be appreciated. Thanks