SQLSTATE(08006) on ProxySQL configuration Java + Postgres + Spring

14 views
Skip to first unread message

Zuerst Zweite

unread,
Aug 28, 2025, 2:23:44 PMAug 28
to proxysql
Hi everyone! I am trying to configure a simple Java application that integrates with ProxySQL. I tried using a default configuration, but it didn’t work. The application didn’t start, and I discovered that the `preferQueryMode=simple` option resolves the issue:
`spring.datasource.url=${JDBC_URL:jdbc:postgresql://123.456.78.999:6133/DA_NAME?preferQueryMode=simple}`. After that, I received an error SQLSTATE(08006) most of the times I tried to make a request using the Spring Repository structure, but when I tried with EntityManager, it works! 

The Repository method sometimes works (a few times):
```java
// works sometimes (few times)
List<Web> webs = webService.findAll();
return webs.toString();
```

The EntityManager approach consistently works, using the following code:

```java
// always works
String jpql = "SELECT r FROM Web r";
TypedQuery<Web> query = entityManager.createQuery(jpql, Web.class);
List<Web> resultList = query.getResultList();
return resultList.toString();
```

The complete error message is: `HikariPool-1 - Connection org.postgresql.jdbc.PgConnection@25abb7c marked as broken because of SQLSTATE(08006), ErrorCode(0)`.

Are there any configuration options or libraries that ensure compatibility between ProxySQL and Spring Boot?

Thanks.
Reply all
Reply to author
Forward
0 new messages