1 Reply Latest reply on Feb 28, 2002 6:27 PM by davidjencks

    Q: calling Connection setReadOnly() / setTransactionIsolatio

      Hi there.

      Just wondering if someone knows for sure if i am allowed to call the setReadOnly()/setTransactionIsolation() method on a connection that i obtained from a DataSource inside the EJB container.
      Well also, does it have any effect?

      The reason i am hesitating is:
      - The javadocs say Note: This method cannot be called while in the middle of a transaction.
      - I am using the Connection inside a method of my SFSB that has a transaction attribute "Required"

      I know i'm not allowed to call the other methods that have a similar warning in the javadocs:
      - setAutoCommit
      - commit
      - rollback

      Hope its clear.
      cheers
      Oliver Henlich

      env
      DB: SQLServer2000
      JDBC Driver: Opta2000_415
      JBoss: 2.4.4

        • 1. Re: Q: calling Connection setReadOnly() / setTransactionIsol
          davidjencks

          Don't do it. You can set transaction isolation for the whole pool in at least 2.4.4 and 3.0.

          There's a requirement we haven't implemented yet for this kind of stuff in jca, where you can specify the connection cannot be shared (or reused, really), then you can set this kind of stuff without breaking the connection for others in the pool. I'm not sure exactly how useful it will be since for many of these kinds of properties, such as tx isolation, you can't change them in the middle of a tx, so you'd have to use BMT, yuckola.

          What do you gain by claiming the connection is read-only over just not writing to it? If this is sufficiently useful we could add it, like tx isolation, to the jca wrappers.