Could not execute JDBC batch update
search cancel

Could not execute JDBC batch update

book

Article ID: 257643

calendar_today

Updated On:

Products

CA API Gateway

Issue/Introduction

The following errors keep keep appearing in the logs :

Connection is read-only. Queries leading to data modification are not allowed; nested exception is java.sql.SQLException: Connection is read-only. Queries leading to data modification are not allowed

Could not execute JDBC batch update; SQL [update service_usage set authorized, completed, request where nodeid and serviceid]; Connection is read-only. Queries leading to data modification are not allowed; nested exception is java.sql.SQLException: Connection is read-only. Queries leading to data modification are not allowed

Environment

API Gateway Container 10.0 CR03 

Cause

If those instances are using failover mode to the database, try adding failOverReadOnly=false to the connection string to avoid running into read-only mode. 

Documentation reference: https://dev.mysql.com/doc/connector-j/en/connector-j-config-failover.html 

 

 

Resolution

At any point in time, your application will be connected to only one database, which is on IP1. Once this database is down, it will switch to second database, IP2. When you set failOverReadOnly to false, the second database will be active in both read/write mode.

Update the JDBC string as: jdbc:mysql://IP1:port1,IP2:port2/CommonDbName?failOverReadOnly=false