1 Reply Latest reply on Feb 2, 2004 3:37 AM by gfzhang

    How to set the isolation level

    gfzhang

      The seesion beans of our application use JDBC to access the database.

      We have to set the isolation level to TRANSACTION_READ_UNCOMMITTED when a connection is got from the data source pool:
      conn.setTransactionIsolation( connection.TRANSACTION_READ_UNCOMMITTED ) ;

      This application works well on JBoss 3.0.8, but it fails on JBoss 3.2.3. The error message is "java.sql.SQLException: You cannot set isolation level during a managed transaction!".

      I know that the above java statement will changed the default isolation level. That is not allowed because in this case the transaction will be commited.

      I want to know if the default isolation level can be set in the data source configuration xml file?

      Thanks for your help.

        • 1. Re: How to set the isolation level
          gfzhang

          cited from: http://www.jboss.org/index.html?module=bb&op=viewtopic&t=14967

          you can set the transaction isolation level in the datasource configuration file name-ds.xml in the deploy directory for jboss 3.x.x.
          this is an example for ms sqlserver:

          Code:


          <local-tx-datasource>
          <jndi-name>matrix</jndi-name>
          <connection-url>jdbc:microsoft:sqlserver://:1433;databaseName=<db-name>;SelectMethod=cursor</connection-url>
          <driver-class>com.microsoft.jdbc.sqlserver.SQLServerDriver</driver-class>
          <user-name>xxx</user-name>
          < password>xxx< /password>
          <transaction-isolation>TRANSACTION_READ_UNCOMMITTED</transaction-isolation>
          </local-tx-datasource>




          possible values are: TRANSACTION_SERIALIZABLE, TRANSACTION_REPEATABLE_READ, TRANSACTION_READ_COMMITTED, TRANSACTION_READ_UNCOMMITTED