DataSource, TxDataSource and Weblogic

Discussions

General J2EE: DataSource, TxDataSource and Weblogic

  1. DataSource, TxDataSource and Weblogic (3 messages)

    Hi,
    The following is a Q&A from Weblogic FAQ site
    Q. When should I use a TxDataSource instead of a DataSource?

    A. If your applications or environment meet any of the following criteria, you should use a TxDataSource instead of a DataSource:

    1. Uses the Java Transaction API (JTA)
    2. Uses the EJB container in WebLogic Server to manage transactions
    3. Includes multiple database updates within a single transaction
    4. Accesses multiple resources, such as a database and the Java Messaging Service (JMS), during a transaction
    5. Uses the same connection pool on multiple servers
    The above is available in the URL
    http://e-docs.bea.com/wls/docs81/faq/jdbc.html#499904

    I am confused with Item 2 in the above list. Does this mean that if we are using declarative transaction management (Container Managed Transactions) in weblogic, we should be using TxDataSource instead of DataSource??

    Should we use a TxDataSource in the above case for other AppServers like Websphere, 9iAS, JBoss etc.

    Somebody please help.

    Thanks in Advance

    Jaise
  2. If you are using CMP, it is difficult to determine in advance whether your Entity will or will not participate in transactions with other databases/resources. Therefore, to be on the safe side, you should use a TxDataSource.

    I think this is a general rule for most EJB servers.
  3. If you are using CMP, it is difficult to determine in advance whether your Entity will or will not participate in transactions with other databases/resources. Therefore, to be on the safe side, you should use a TxDataSource.I think this is a general rule for most EJB servers.
    Paul,
    I am using BMP and I have no entity beans at all. All I am using are Stateless Session Bean and some DAOs. I can very specifically say that my transactions will involve only a single database(single user) only.

    If I use TxDataSource to be on the safer side, will there be any overheads or performance degradation for my application??

    Thanks in Advance
    Jaise
  4. In my experience, the overhead of TX support is pretty minimal, if you are not participating in multi-resource transactions. I am sure there are exceptions, though, depending on your EJB server, JDBC drivers, etc.

    Why don't you write some test code to exercise your system and find out? After all, changing from a TX to non-TX DataSource is just changing a config value, so you should be able to compare/contrast performance pretty easily.