Connections unexpectedly closed when using DB.use with a JNDI datasource with squerylrecord
Per this discussion, the database connection is often (if not mostly) unexpectedly closed when attempting to use squerylrecord with DB.use and a JNDI DataSource.
To reproduce:
a) Configure a JNDI DataSource in your servlet container.
b) Then in Boot.scala:
1) tell the DefaultConnectionIdentifier the appropriate jndi name.
2) call SquerylRecord.init() with the appropriate adapter.
3) use DefaultConnectionIdentifier with the DB.buildLoanWrapper and
add it to S.around
c) Use squerylrecord in such a way that it requires a Connection to the DataSource
Tests should immediately reveal that the connections squeryl tries to use are unexpectedly closed.
To reproduce:
a) Configure a JNDI DataSource in your servlet container.
b) Then in Boot.scala:
1) tell the DefaultConnectionIdentifier the appropriate jndi name.
2) call SquerylRecord.init() with the appropriate adapter.
3) use DefaultConnectionIdentifier with the DB.buildLoanWrapper and
add it to S.around
c) Use squerylrecord in such a way that it requires a Connection to the DataSource
Tests should immediately reveal that the connections squeryl tries to use are unexpectedly closed.
Leave a comment
on 2011-05-04 16:41 *
By David Whittaker
Milestone set to 2.4-M1
Status changed from New to Accepted
Sorry for not updating this sooner. I have been able to reproduce the issue with your test case, thanks for that. I'm planning on getting this fixed for 2.4, I just haven't had time for the deeper dive into DB and Squeryl's external transaction management that it will require. Hopefully I've have more for you soon.