JDBC Connection Timeout (SQLState 08001) with Local PostgreSQL Database

0
I am encountering a connection issue while running my Mendix application locally. The runtime fails to connect to the PostgreSQL database with a "Connection attempt timed out" message.Error Log: ConnectionBus: Opening JDBC connection to 127.0.0.1/AWK-Local failed with SQLState: 08001 Error code: 0 Message: "Connection attempt timed out."Troubleshooting steps taken so far:Verified that the PostgreSQL service is running via Laragon.Verified the port using telnet localhost 5432 and the status is Connected.Changed the host address from localhost to 127.0.0.1 in the App Settings.Temporarily disabled Windows Firewall, but the issue persists.Question: Are there any additional parameters required in the Mendix Custom Connection String to fix the JDBC handshake? Or are there specific settings in pg_hba.conf that I might have missed?Any help would be greatly appreciated. Thank you!
asked
1 answers
0

Hi Imam,


The first thing that caught my attention is the connection target in the log:


Plain Text

Opening JDBC connection to 127.0.0.1/AWK-Local


If telnet localhost 5432 succeeds, then PostgreSQL is listening on the port, so a pure network/firewall issue is less likely.


A few things I would verify:


1. Test the database outside Mendix


Try connecting with:


Shell

psql -h 127.0.0.1 -p 5432 -U <username> -d AWK-Local


or a tool such as pgAdmin/DBeaver using exactly the same host, port, database, username, and password configured in Mendix.


If that fails, the issue is on the PostgreSQL side rather than Mendix.


2. Check the actual JDBC URL


Make sure the custom connection string is using the correct format, for example:


Plain Text

jdbc:postgresql://127.0.0.1:5432/AWK-Local


I've seen cases where the database name was correct but the port was omitted or the JDBC URL was malformed.


3. Verify postgresql.conf


Check:


Plain Text

listen_addresses = '*'


or


Plain Text

listen_addresses = 'localhost'



and ensure PostgreSQL was restarted afterward.


4. Verify pg_hba.conf


Ensure you have entries similar to:


Plain Text

host all all 127.0.0.1/32 md5

host all all ::1/128 md5


(or scram-sha-256 depending on your PostgreSQL version).


If pg_hba.conf is incorrect, PostgreSQL usually returns an authentication error, but it's still worth checking.


5. Check for SSL mismatch


If PostgreSQL is configured differently than what the JDBC driver expects, try explicitly adding:


Plain Text

?sslmode=disable


Example:


Plain Text

jdbc:postgresql://127.0.0.1:5432/AWK-Local?sslmode=disable


6. Verify database name


One thing I'd double-check is that:


Plain Text

AWK-Local


is actually the PostgreSQL database name and not just the configuration name shown in Mendix.


The timeout message is slightly unusual because when PostgreSQL is reachable but credentials are wrong, you typically get:


Plain Text

password authentication failed


rather than:


Plain Text

Connection attempt timed out


Since:


PostgreSQL service is running ✅

Port 5432 is reachable ✅

Firewall disabled ✅


I would next verify the exact JDBC URL, database name, and whether you can connect with the same credentials using psql or pgAdmin. That usually reveals the root cause very quickly.


Hope this helps.

answered