I know my message can seem a duplicate of another, but I don't think so. Tell me if I'm wrong.
I just finished a free software in Java/swing/postgresql. It was successfully tested on Windows and Linux.
Now I am trying to make the documentation of it, and I'm on the "Installing postgresql server" part of the documentation.
The problem is that I can't remember what I've done to make the application work with PostgreSQL (I know it's lame...).
The JDBC string is made this way in the code:
// Open the SQL Connection
m_sql_connection = DriverManager.getConnection("jdbc:postgresql://"+m_postgresql_server_name+":"+m_postgresql_port_number+"/"+m_postgresql_database_name, "postgres", "<not empty>");
The facts:
- I work on a Windows 7 machine 64 bit
- The PostgreSQL server is running (I see the service Started)
- The PostgreSQL server configuration seems OK
- I use login: postgres / pass: in my JDBC string
- I can make the queries I want with pgAdmin III and they work
- The database server is on the same machine as the "*.jar" application file
- The jar application works well on a Linux version and another Windows 7 32 bit machine (the development machine)
- I disabled my antivirus (just in case...)
- psql.exe works well (I could insert data with it)
Edit 1 -> JJF - I just added postgresql.exe and pg_ctl.exe in the windows firewall, and checked Both checkboxes for each (Public and Home/Work(Private) )
Result: Same Error
Edit2 -> Hardik Patel - Skype is already OFF
Edit 3 -> JJF - After full stop of Windows Firewall, still the same problem
The error I get is this one:
Connection refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections
I wonder if I don't have to "unlock" the postgres account to allow it to access data through JDBC.
Edit 4 - Horse with no name - I replaced localhost by 127.0.0.1 - The port is the standard port 5432, validated with psql - I tested the psql.exe (working) command line before trying the JDBC connection (not working) - Still the same result...
Edit 5 - I am going to put some trace to see if i can get more information
127.0.0.1instead to verify that point) - a_horse_with_no_name