hi,i want to start database which can accept tcp/ip connecttions,now
there is a question:
i start database with the command:
/usr/local/pgsql/bin/postmaster -o "-i" -D /usr/local/pgsql/data
and edit pg_hba.conf with adding the line :
host all all 127.0.0.1/32 trust
host rftDatabase globus 127.0.0.1 255.255.255.255 trust
and after that i cant use psql to connect the database,here is the message:
psql: FATAL: invalid command-line arguments for server process
HINT: Try "postgres --help" for more information.
but if i start with : /usr/local/pgsql/bin/postmaster -o -i -D
/usr/local/pgsql/data
then i can connet database psql command,
in two situation i cat connect database with the file:
String url="jdbc:postgresql://xiaohua/rftDatabase";
String user = "globus";
String password = "globus";
try
{
Class.forName("org.postgresql.Driver");
System.out.println("9999999999");
}
catch(Exception ex)
{
System.out.println("Sub ------------: " + ex);
}
the error message is that:
Unable to connect======================
org.postgresql.util.PSQLException: 连接尝试失败。
at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:136)
at org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:65)
at org.postgresql.jdbc2.AbstractJdbc2Connection.(AbstractJdbc2Connection.java:117)
at org.postgresql.jdbc3.AbstractJdbc3Connection.(AbstractJdbc3Connection.java:30)
at org.postgresql.jdbc3.Jdbc3Connection.(Jdbc3Connection.java:24)
at org.postgresql.Driver.connect(Driver.java:235)
at java.sql.DriverManager.getConnection(DriverManager.java:512)
at java.sql.DriverManager.getConnection(DriverManager.java:171)
at TableDisplay.(TableDisplay.java:39)
at TableDisplay.main(TableDisplay.java:158)
Caused by: java.net.SocketException: Invalid argument or cannot assign
requested address
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:305)
at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:171)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:158)
at java.net.Socket.connect(Socket.java:452)
at java.net.Socket.connect(Socket.java:402)
at java.net.Socket.(Socket.java:309)
at java.net.Socket.(Socket.java:124)
at org.postgresql.core.PGStream.(PGStream.java:58)
at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:77)
... 9 more
Exception in thread "main" java.lang.NullPointerException
at TableDisplay.getTable(TableDisplay.java:69)
at TableDisplay.(TableDisplay.java:55)
at TableDisplay.main(TableDisplay.java:158)
the jdbc driver is rightly confirmed and the classpath is right.
this question exists for few days and how should do next?thaks for
your attention!