X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 3775514B286E for ; Wed, 11 Aug 2004 17:33:00 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 52599-08 for ; Wed, 11 Aug 2004 20:32:51 +0000 (GMT) Received: from planae.com.br (nat.planae.com.br [200.210.129.190]) by svr1.postgresql.org (Postfix) with SMTP id 3E15D14B286A for ; Wed, 11 Aug 2004 17:32:45 -0300 (ADT) Received: (qmail 16567 invoked by uid 0); 11 Aug 2004 20:39:59 -0000 Received: from unknown (HELO planae.com.br) (gfnobrega@192.168.0.215) by 192.168.0.3 with SMTP; 11 Aug 2004 20:39:59 -0000 Message-ID: <411A8277.1000509@planae.com.br> Date: Wed, 11 Aug 2004 17:32:55 -0300 From: =?ISO-8859-1?Q?Gustavo_Franklin_N=F3brega_-_PLANAE?= Organization: PLANAE User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.5) Gecko/20040806 X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgsql-admin@postgresql.org Subject: Re: Connecting Postgres using other network Content-Type: multipart/mixed; boundary="------------070406000304030103090708" X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=1.3 tagged_above=0.0 required=5.0 tests=HTML_40_50, HTML_FONTCOLOR_BLUE, HTML_FONTCOLOR_RED, HTML_FONTCOLOR_UNSAFE, HTML_MESSAGE, HTML_TITLE_EMPTY X-Spam-Level: * X-Archive-Number: 200408/78 X-Sequence-Number: 14473 This is a multi-part message in MIME format. --------------070406000304030103090708 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit --------------070406000304030103090708 Content-Type: message/rfc822; name="Re: [ADMIN] Connecting Postgres using other network" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="Re: [ADMIN] Connecting Postgres using other network" Message-ID: <411A81AE.5030204@planae.com.br> Date: Wed, 11 Aug 2004 17:29:34 -0300 From: =?ISO-8859-1?Q?Gustavo_Franklin_N=F3brega_-_PLANAE?= Organization: PLANAE User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.5) Gecko/20040806 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Tom Haddon Subject: Re: [ADMIN] Connecting Postgres using other network References: <0E52D69E86D25840AAE3611CB657F9F80AA023@millenium.equilar.com> In-Reply-To: <0E52D69E86D25840AAE3611CB657F9F80AA023@millenium.equilar.com> Content-Type: text/html; charset=us-ascii Content-Transfer-Encoding: 7bit Hi Shayer,
I think that you need to add your IP address from your host client to pg_hba.conf.
like:
host    all         all        192.168.1.10          255.255.255.255   trust
where 192.168.1.10 is your IP client

best regards,



Tom Haddon wrote:
Message
Just to check, you are using a non-standard port (6432 - the standard is 5432)?
-----Original Message-----
From: pgsql-admin-owner@postgresql.org [mailto:pgsql-admin-owner@postgresql.org] On Behalf Of Mohammad Tanvir Huda
Sent: Wednesday, August 11, 2004 12:40 PM
To: pgsql-admin@postgresql.org
Subject: [ADMIN] Connecting Postgres using other network

Hello Everyone
 
I have installed Postgres server in a network and  i am trying to use the database using
Java code from other network.
 
I have set the tcp_ip=true in postgresql.conf file.
I have also add the follwing line in the pg_hba.conf

host    all         all        127.0.0.0          255.255.255.255   trust
 
Then i start the server in port 6432.
 
After that i want to access the application using the following javacode.
 
import java.sql.*;   // All we need for JDBC
import java.text.*;
import java.io.*;
public class HelloPost
{
  Connection       db;        // A connection to the database
  Statement        sql;       // Our statement to run queries with
  DatabaseMetaData dbmd;      // This is basically info the driver delivers
                              // about the DB it just connected to. I use
                              // it to get the DB version to confirm the
                              // connection in this example.
  public HelloPost()
    throws ClassNotFoundException, SQLException
  {
    String database = "test";
    String username = "abc";
    String password = "xyz";
    try{
     Class.forName("org.postgresql.Driver"); file://load the driver
        db = DriverManager.getConnection("jdbc:postgresql://abc.csse.uts.edu:6432:test",
                                     username,
                                     password); file://connect to the db
     dbmd = db.getMetaData(); file://get MetaData to confirm connection
     System.out.println("Connection to "+dbmd.getDatabaseProductName()+" "+
                       dbmd.getDatabaseProductVersion()+" successful.\n");
     sql = db.createStatement(); file://create a statement that we can use later
    }catch (ClassNotFoundException e) {
            System.err.println( "Driver not found: " + e + "\n" + e.getMessage() );
    }
    db.close();
  }
 public static void main (String args[])
   {
     try
     {
       HelloPost demo = new HelloPost();
     }
     catch (Exception ex)
     {
       System.out.println("***Exception:\n"+ex);
       ex.printStackTrace();
     }
   }
 }
But this give me the following error

Exception: org.postgresql.util.PSQLException: Connection refused. Check that the hostname and port are correct and that the post
 accepting TCP/IP connections.
Connection refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections
.
Can anyone please tell me where is the error. what should i doo ..
 
regards
 
Shayer
 


Do you Yahoo!?
Yahoo! Mail - 50x more storage than other providers!


-- 
Gustavo Franklin Nóbrega
Infra Estrutura - Banco de Dados
Planae - Tecnologia Da Informação
Fone/Fax +55 14 3224-3066 Ramal : 210
http://www.planae.com.br

--------------070406000304030103090708--