C
Chase Preuninger
I started my Postgres DBMS and I can connect to it through the
services window in Netbeans but I can seem to connect using code.
Also I do have the dirver int the class path which passes the
Class.forName("driver"); test.
System.setProperty("jdbc.drivers", "org.postgresql.Driver");
Connection conn = DriverManager.getConnection("jdbcostgresql:////
127.0.0.1//Notes", "myun", "mypw");
Exception in thread "main" org.postgresql.util.PSQLException: The
connection attempt failed.
at
org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:
137)
at
org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:
66)
at
org.postgresql.jdbc2.AbstractJdbc2Connection.<init>(AbstractJdbc2Connection.java:
124)
at
org.postgresql.jdbc3.AbstractJdbc3Connection.<init>(AbstractJdbc3Connection.java:
30)
at
org.postgresql.jdbc3.Jdbc3Connection.<init>(Jdbc3Connection.java:24)
at org.postgresql.Driver.makeConnection(Driver.java:386)
at org.postgresql.Driver.connect(Driver.java:260)
at java.sql.DriverManager.getConnection(DriverManager.java:
582)
at java.sql.DriverManager.getConnection(DriverManager.java:
185)
at
com.cpsoft.mynotes.database.accounts.DatabaseAccount.main(DatabaseAccount.java:
17)
Caused by: java.net.UnknownHostException: /
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:177)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
at java.net.Socket.connect(Socket.java:519)
at java.net.Socket.connect(Socket.java:469)
at java.net.Socket.<init>(Socket.java:366)
at java.net.Socket.<init>(Socket.java:180)
at org.postgresql.core.PGStream.<init>(PGStream.java:62)
at
org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:
77)
... 9 more
Java Result: 1
services window in Netbeans but I can seem to connect using code.
Also I do have the dirver int the class path which passes the
Class.forName("driver"); test.
System.setProperty("jdbc.drivers", "org.postgresql.Driver");
Connection conn = DriverManager.getConnection("jdbcostgresql:////
127.0.0.1//Notes", "myun", "mypw");
Exception in thread "main" org.postgresql.util.PSQLException: The
connection attempt failed.
at
org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:
137)
at
org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:
66)
at
org.postgresql.jdbc2.AbstractJdbc2Connection.<init>(AbstractJdbc2Connection.java:
124)
at
org.postgresql.jdbc3.AbstractJdbc3Connection.<init>(AbstractJdbc3Connection.java:
30)
at
org.postgresql.jdbc3.Jdbc3Connection.<init>(Jdbc3Connection.java:24)
at org.postgresql.Driver.makeConnection(Driver.java:386)
at org.postgresql.Driver.connect(Driver.java:260)
at java.sql.DriverManager.getConnection(DriverManager.java:
582)
at java.sql.DriverManager.getConnection(DriverManager.java:
185)
at
com.cpsoft.mynotes.database.accounts.DatabaseAccount.main(DatabaseAccount.java:
17)
Caused by: java.net.UnknownHostException: /
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:177)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
at java.net.Socket.connect(Socket.java:519)
at java.net.Socket.connect(Socket.java:469)
at java.net.Socket.<init>(Socket.java:366)
at java.net.Socket.<init>(Socket.java:180)
at org.postgresql.core.PGStream.<init>(PGStream.java:62)
at
org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:
77)
... 9 more
Java Result: 1