Tilted Forum Project Discussion Community

Tilted Forum Project Discussion Community (https://thetfp.com/tfp/)
-   Tilted Technology (https://thetfp.com/tfp/tilted-technology/)
-   -   Java/JDBC/postgresql problems (https://thetfp.com/tfp/tilted-technology/38952-java-jdbc-postgresql-problems.html)

Moskie 12-13-2003 03:45 AM

Java/JDBC/postgresql problems
 
I'm having some difficulties connecting to my postgresql server through Java. Here's a run-down of how I've done things so far.

1. Got postgresql running form Cygwin, using the command "postmaster -D ~/db". It loads and eventually says "database system is ready".

2. I'm able to connect to a database I've created (called 'db') from another Cygwin prompt with "psql db". From that point, everything goes as planned. I can update/inspect the database as I please. This makes me think that the database is doing everything it should: it's running properly, is listening/responding as it should, and it's physcially possible to connect to this database.

3. Now trying to connect to this database from a Java program is giving me headaches. Using the line:
Code:

db = DriverManager.getConnection("jdbc:postgresql://localhost/db", "moskie", "oo2");
the following exception is thrown: "Connection refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections." I've tried using different ports besides the default (using the '-p 65535' flag on postmaster, then trying to connect to 'localhost:65535'), but I get the same exception.



What am I doing wrong?


All times are GMT -8. The time now is 02:26 PM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2026, vBulletin Solutions, Inc.
Search Engine Optimization by vBSEO 3.6.0 PL2
© 2002-2012 Tilted Forum Project


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46