Hi,
I am trying to connect postgresql database from a remote pc. Here is my code:
Class.forName("org.postgresql.Driver");
Connection conn = DriverManager.getConnection("jdbc:postgresql://machine.mylbl.gov:5432/mydatabase", "username", "passwd");
But I always get the following exception:
org.postgresql.util.PSQLException: The connection attempt failed.
Exception: java.io.EOFException
Stack Trace:
java.io.EOFException
at org.postgresql.core.PGStream.ReceiveChar(PGStream.java:244)
at org.postgresql.core.v3.ConnectionFactoryImpl.doAuthentication(ConnectionFactoryImpl.java:222)
at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:94)
at org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:65)
at org.postgresql.jdbc2.AbstractJdbc2Connection.<init>(AbstractJdbc2Connection.java:106)
at org.postgresql.jdbc2.Jdbc2Connection.<init>(Jdbc2Connection.java:15)
at org.postgresql.Driver.connect(Driver.java:140)
at java.sql.DriverManager.getConnection(DriverManager.java:538)
at java.sql.DriverManager.getConnection(DriverManager.java:188)
at Test.main(Test.java:29)
End of Stack Trace
at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:119)
at org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:65)
at org.postgresql.jdbc2.AbstractJdbc2Connection.<init>(AbstractJdbc2Connection.java:106)
at org.postgresql.jdbc2.Jdbc2Connection.<init>(Jdbc2Connection.java:15)
at org.postgresql.Driver.connect(Driver.java:140)
at java.sql.DriverManager.getConnection(DriverManager.java:538)
at java.sql.DriverManager.getConnection(DriverManager.java:188)
at Test.main(Test.java:29)
Why:
Thanks,
Tony
Do you Yahoo!?
Discover all that�s new in
My Yahoo!