Skip site navigation (1) Skip section navigation (2)

connectivity problem

From: adp adp <adp_group2004(at)yahoo(dot)co(dot)in>
To: pgsql-jdbc(at)postgresql(dot)org
Subject: connectivity problem
Date: 2004-01-30 09:51:09
Message-ID: 20040130095109.29157.qmail@web8102.in.yahoo.com (view raw or flat)
Thread:
Lists: pgsql-jdbc
I am using postgreSQL 7.3,j2sdk1.4.2 and have
installed jdbc driver as pg73jdbc3.jar


Here is the classpath :
exportCLASSPATH=/root/j2sdk1.4.2/bin/test1.java:/root/j2sdk_nb/j2sdk1.4.2/jre/lib/ext/pg73jdbc3.jar:.

and here is the code:

import java.sql.*;
class test2{
  public static void main (String args[]) {
                                                      
                                
     try{
                                                      
                                
         Class.forName("org.postgresql.Driver");      
               
                                                      
                                
      String
url="jdbc:postgresql://127.0.0.1/test";
      Connection con =
DriverManager.getConnection(url, "postgres", "");
      Statement stm= con.createStatement();
                                                      
                                
stm.setQueryTimeout(10);
ResultSet rs = stm.executeQuery("select col1 from
test1");
                                                      
                                
rs.next();
                                                      
                                
System.out.println(rs.getString(1));
}catch(ClassNotFoundException  e) {
                                                      
                                
                                                      
                                
 System.out.println("Exception");
 System.out.println(e.toString());
}
 catch(SQLException e) {
                                                      
                                
                                                      
                                
 System.out.println("Exception");
 System.out.println(e.toString());
}
}
}

and now I receive this error irrespective of the host
and port address used in the url:
Exception
Connection refused. Check that the hostname and port
are correct and that the postmaster is accepting
TCP/IP connections.


next I tried the foll:

[root(at)ws128 bin]# postmaster -c tcpip_socket=true
"root" execution of the PostgreSQL server is not
permitted.
                                                      
                         
The server must be started under an unprivileged user
id to prevent
a possible system security compromise.  See the
documentation for
more information on how to properly start the server.

Then I tried this:
[root(at)ws128 bin]# su postgres
bash-2.05b$ postmaster -c tcpip_socket=true
postmaster does not know where to find the database
system data.
You must specify the directory that contains the
database system
either by specifying the -D invocation option or by
setting the
PGDATA environment variable.


I think the problem is with postmaster settings, I
tried to set tcpip_socket into the postgresql.conf
file but it didnt work.
Please help.

________________________________________________________________________
Yahoo! India Mobile: Download the latest polyphonic ringtones.
Go to http://in.mobile.yahoo.com

Responses

pgsql-jdbc by date

Next:From: Paul ThomasDate: 2004-01-30 11:22:23
Subject: Re: connectivity problem
Previous:From: Kris JurkaDate: 2004-01-30 09:27:09
Subject: Re: [SQL] java.lang.StringIndexOutOfBoundsException: String

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group