I have a class Im trying to build out with has a DSLContext Autowired in by
Spring with Spring's TransactionAwareDataSourceProxy. My jOOQ related code
looks something along the lines of:
@Autowired
private DSLContext create;
public boolean myMethod(String fieldOne, int fieldTwo) {
String fieldThree = getFieldThree();
try {
MyTablePojo newPojo = new MyTablePojo(); //This
is an auto generated pojo
newPojo.setFieldOne(fieldOne);
newPojo.setFieldTwo(fieldTwo);
newPojo.setFieldThree(fieldThree);
MyTableRecord newRecord = create.newRecord(MY_TABLE, newPojo);
newRecord.insert();
return true;
} catch (Exception e) {
log.log(Level.WARNING, "ERROR Occurred", e);
return false;
}
}
I can't seem to figure out why the db connection is always being marked as
read only, and I keep getting the exception below:
org.jooq.exception.DataAccessException: SQL [insert into
`MyDatabase`.`MyTable` (`field_one`, `field_two`, `field_three`) values (?,
?, ?)]; Connection is read-only. Queries leading to data modification are
not allowed
at org.jooq.impl.Utils.translate(Utils.java:1690)
at
org.jooq.impl.DefaultExecuteContext.sqlException(DefaultExecuteContext.java:660)
at org.jooq.impl.AbstractQuery.execute(AbstractQuery.java:356)
at
org.jooq.impl.TableRecordImpl.storeInsert0(TableRecordImpl.java:177)
at org.jooq.impl.TableRecordImpl$1.operate(TableRecordImpl.java:143)
at org.jooq.impl.RecordDelegate.operate(RecordDelegate.java:128)
at
org.jooq.impl.TableRecordImpl.storeInsert(TableRecordImpl.java:139)
at org.jooq.impl.TableRecordImpl.insert(TableRecordImpl.java:132)
at org.jooq.impl.TableRecordImpl.insert(TableRecordImpl.java:127)
... [Redacted]
at
org.springframework.scheduling.support.DelegatingErrorHandlingRunnable.run(DelegatingErrorHandlingRunnable.java:54)
at
java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)
at
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180)
at
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294)
at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.sql.SQLException: Connection is read-only. Queries leading
to data modification are not allowed
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1055)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:956)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:926)
at
com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1970)
at
com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1937)
at
com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1922)
at
org.jooq.tools.jdbc.DefaultPreparedStatement.executeUpdate(DefaultPreparedStatement.java:88)
at org.jooq.impl.AbstractDMLQuery.execute(AbstractDMLQuery.java:349)
at org.jooq.impl.AbstractQuery.execute(AbstractQuery.java:342)
... 18 more
After several hours of searching online and trying a couple of different
changes, I've yet to come up with anything useful. If anyone has any
suggestions as to what to look at next, I would greatly appreciate it.
--
Tim
--
You received this message because you are subscribed to the Google Groups "jOOQ
User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.