vBulletin Search Engine Optimization
| |||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| hi everybody, i have a problem connecting to postgres using the jdbc driver. took the org.postgresql.test.jdbc2.DriverTest and modified it to use String url = "jdbc String user = "username"; String pass = "password"; i get the exception org.postgresql.util.PSQLException: Connection Refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections. however, using psql -h localhost -U username -W and then specifying the password works. so i do not see how this could be a general problem with postgresql listening on the wrong interface or not accepting connections from the local host. btw, i use psql 8.1.4 on ubuntu, jdbc is postgresql-8.1-408.jdbc2.jar any ideas? thanks, david ---------------------------(end of broadcast)--------------------------- TIP 6: explain analyze is your friend |
| |||
| On Thu, 1 Feb 2007, david@mediagonal.ch wrote: > i have a problem connecting to postgres using the jdbc driver. > > String url = "jdbc > String user = "username"; > String pass = "password"; > > > i get the exception org.postgresql.util.PSQLException: Connection > Refused. Check that the hostname and port are correct and that the > postmaster is accepting TCP/IP connections. > > however, using psql -h localhost -U username -W and then specifying the > password works. so i do not see how this could be a general problem with > postgresql listening on the wrong interface or not accepting connections > from the local host. > > btw, i use psql 8.1.4 on ubuntu, jdbc is postgresql-8.1-408.jdbc2.jar > Debian variants often have multiple servers installed on multiple ports. Try adding explicit port numbers to both psql and jdbc connections to ensure that you're getting the same thing. Kris Jurka ---------------------------(end of broadcast)--------------------------- TIP 3: Have you checked our extensive FAQ? http://www.postgresql.org/docs/faq |
| ||||
| thanks a lot. Ubuntu 6.10 sets the port to 5433 instead of 5432. psql seems to consider this when not specifying a port - jdbc not. i changed the port setting in /etc/postgresql/8.1/main/postgresql.conf to 5432 and stopped postgres and started it new. now jdbc gets the connection. (restart / reload did not change the port.) Kris Jurka wrote: > > > Debian variants often have multiple servers installed on multiple ports. > Try adding explicit port numbers to both psql and jdbc connections to > ensure that you're getting the same thing. > > Kris Jurka > > On Thu, 1 Feb 2007, david@mediagonal.ch wrote: > >> i have a problem connecting to postgres using the jdbc driver. >> >> String url = "jdbc >> String user = "username"; >> String pass = "password"; >> >> >> i get the exception org.postgresql.util.PSQLException: Connection >> Refused. Check that the hostname and port are correct and that the >> postmaster is accepting TCP/IP connections. >> >> however, using psql -h localhost -U username -W and then specifying >> the password works. so i do not see how this could be a general >> problem with postgresql listening on the wrong interface or not >> accepting connections from the local host. >> >> btw, i use psql 8.1.4 on ubuntu, jdbc is postgresql-8.1-408.jdbc2.jar >> ---------------------------(end of broadcast)--------------------------- TIP 2: Don't 'kill -9' the postmaster |