Use case
User needs the select statements to be generated as below to make sure none of them create lock on the DB table:
Select * from company with (NOLOCK) where ...
Solution
Such effect can be achieved by using JNDI connection, and applying the READ_UNCOMMITTED transaction isolation on the connection level. The JNDI connection definition should look something like this:
<Resource name="jdbc/databaseName" auth="Container" type="javax.sql.DataSource" maxActive="100" maxIdle="30" maxWait="10000" username="xxxx" password="xxxx" defaultTransactionIsolation="READ_UNCOMMITTED" driverClassName="net.sourceforge.jtds.jdbc.Driver" url="jdbc:jtds:sqlserver://localhost:1433/databaseName" />
You can also find more info about the READ_UNCOMMITED isolation level here: https://msdn.microsoft.com/en-us/library/ms173763.aspx
Recommended Comments
There are no comments to display.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now