Yes, you can have several jOOQ Configurations in your system. See some more details here: http://www.jooq.org/doc/3.1/manual/sql-building/dsl-context
If you're using jOOQ for CRUD operations (through UpdatableRecord), you might have to "re-attach" fetched records from your SLAVE database to a MASTER database Configuration prior to calling store() or other methods. This can be done explicitly, of course, through UpdatableRecord.attach(Configuration): http://www.jooq.org/javadoc/latest/org/jooq/Attachable.html#attach(org.jooq.Configuration) Or better, globally and transparently by implementing an ExecuteListener that overrides the ConnectionProvider on the ExecuteListener.start() event http://www.jooq.org/javadoc/latest/org/jooq/ExecuteListener.html#start(org.jooq.ExecuteContext) ExecuteContext.type() will indicate whether the currently executed query is a READ or WRITE operation (or DDL, BATCH, etc.) http://www.jooq.org/javadoc/latest/org/jooq/ExecuteContext.html#type() The latter is probably what you want. Cheers Lukas 2013/7/18 Venkat Sadasivam <[email protected]> > Is it possible to change the connection provider in based on read or write > operation to have separate data sources. > > I want to route readonly operations to SLAVE database and write operations > to MASTER database. > > Thanks, > Venkat > -- 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/groups/opt_out.
