I have transferred my PostgreSQL database from an old server to an OCI (Oracle Cloud Infrastructure) instance. The old server was running PostgreSQL version 8.4, and the OCI instance has been upgraded to PostgreSQL 15.3. I'm currently using Java 8 and want to connect to the database using Java.
When I try to connect to the PostgreSQL database from my local machine, the connection is successful, and I can perform all operations. However, when I try to connect to the PostgreSQL database from the OCI instance, the connection works, and I can fetch and update data, but I encounter an error when trying to insert data. The error message is as follows:
Error updating database. Cause: org.postgresql.util.PSQLException: Returning autogenerated keys is only supported for 8.2 and later servers.
SQL: insert into t_buyer_cart (visitorno, chartno, lineno, thingno, flag, added_by, added_on, updated_by, updated_on, del_flag) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
Cause: org.postgresql.util.PSQLException: Returning autogenerated keys is only supported for 8.2 and later servers.; uncategorized SQLException for SQL []; SQL state [0A000]; error code [0]; Returning autogenerated keys is only supported for 8.2 and later servers.; nested exception is org.postgresql.util.PSQLException: Returning autogenerated keys is only supported for 8.2 and later servers.
To resolve this issue, I have tried the following steps:
- Upgrading the JDBC version to the latest version (42.6.0).
- Downgrading the JDBC version.
- Checking the local machine connection.
- Checking detailed logs (confirming correct PostgreSQL and JDBC versions).
- Commenting out the return method (only trying to inserting data).
- Checking the API load balancer logs.
- Checking the PostgreSQL database logs.
- Allowing ingress and egress on port 5432 in the VCN (Virtual Cloud Network) settings.
- Checking the PostgreSQL configuration file for maximum connections and remote connection settings.
- Verifying that the telnet connection is working.
- Checking with the root user (postgres user).
- Verifying table rights for all users.
- Checking permissions for the JAR file and
pom.xml
file (both set to 777).
Despite trying these steps, the issue remains unresolved.
Anyone have an idea behind the occurrence of this type of issue and how to resolve it?
Thanks in advance.