[CONJ-786] Connection.setReadOnly has no effect Created: 2020-04-28 Updated: 2020-05-14 Resolved: 2020-05-14 |
|
| Status: | Closed |
| Project: | MariaDB Connector/J |
| Component/s: | pooling |
| Affects Version/s: | 2.5.4, 2.6.0 |
| Fix Version/s: | 2.6.1 |
| Type: | Bug | Priority: | Major |
| Reporter: | Cheong Chung Onn | Assignee: | Diego Dupin |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Environment: |
Ubuntu 18.04, 10.4.12-MariaDB-1:10.4.12+maria~bionic-log |
||
| Description |
|
Wanted to create a read-only transaction using jConnector. Expect Mariadb to return a java.sql.SQLException when there is an update statement within a read only transaction See the code below. 1. Mariadb commits the the statement and return success 2. Mariadb returns an exception, 'set transaction read only' is sent to Mariadb prior to starting an update statement. connection.createStatement().execute("set transaction read only") |
| Comments |
| Comment by Diego Dupin [ 2020-05-14 ] |
|
This is implemented only for multiple host (https://mariadb.com/kb/en/about-mariadb-connector-j/#failover-and-load-balancing-modes) Default configuration doesn't force read-only, but this can be set using option "assureReadOnly" That will be added in 2.7 version for single host with same behaviour (option |