Class ReadonlyDriver

All Implemented Interfaces:
Driver

@DriverCapability(prefix="readonly", description="Enforces read-only database access", capabilities={"security","filtering"}) @DriverParameter(name="allowDDL",type=BOOLEAN,description="Allow DDL statements (CREATE, ALTER, DROP)",defaultValue="false") @DriverParameter(name="allowDML",type=BOOLEAN,description="Allow DML statements (INSERT, UPDATE, DELETE)",defaultValue="false") @DriverParameter(name="message",type=STRING,description="Custom error message for blocked operations") public class ReadonlyDriver extends AbstractProxyDriver
ReadonlyDriver enforces read-only database access by blocking write operations.

URL format: jdbc:readonly[param=value,...]:jdbc:target:...

Blocked operations (by default):

  • DML: INSERT, UPDATE, DELETE, MERGE, UPSERT, REPLACE, TRUNCATE
  • DDL: CREATE, ALTER, DROP, RENAME
  • DCL: GRANT, REVOKE
  • TCL: (transactions are allowed)

Example URLs:

 jdbc:readonly:jdbc:postgresql://localhost/mydb
 jdbc:readonly[allowDDL=true]:jdbc:postgresql://localhost/mydb
 jdbc:readonly[message=No writes allowed in reporting mode]:jdbc:mysql://localhost/db