Transaction settings and JDBC Data Sources: we’ve all been there and pulled our hair out trying to figure out what the issue was. Configuring them, however, is often much easier. But you need to know how to work around a small nuisance in MyST Studio to be able to accomplish your goals easily.
When you roll out a new JDBC Data Source on WebLogic through MyST, you’ll automatically get the box Supports Global Transactions ticked. But there are situations where you don’t want that transaction to participate in a global transaction at all. We’ll show you how to achieve this by using a little known trick in MyST Studio.
In WebLogic Server, a JDBC Data Source has to be one of two possible options: it either supports Global Transactions, or does not support Global Transactions. Yet, if it supports Global Transactions you’ll get a second choice, where you can set the ‘type’ of support. This can be one of three choices:
- Logging Last Resource
- Emulate Two-Phase Commit
- One-Phase Commit
WebLogic Server defaults to the latter option upon creation of a JDBC Data Source.
Please note that this has nothing to do with the Driver being either XA or non-XA, that is a different type of setting altogether. We’re discussing a non-XA Driver here.
The default settings for a non-XA JDBC Data Source: Supports Global Transactions, One-Phase Commit.
In MyST Studio, navigate to your Platform Blueprint or Platform Model, and find ‘WebLogic Domain Configuration‘ -> ‘ JDBC Data Sources‘.
A more or less standard JDBC Data Source would look something like this:
Please note that the General Parameter called Transaction is not set.
With the Data Source configured like this in MyST Studio, we’ll achieve the situation in WebLogic as shown before. A non-XA Data Source is created in your domain, where the tickbox ‘Supports Global Transactions‘ is checked, and the type is set to ‘One-Phase Commit‘.
We can, however, select the value for Transaction from a small drop down list:
MyST Studio will let you select all possible values which show up as the radio buttons in the Console, but there is no direct way to uncheck the tick box for Global Transactions.
RAW Values to the rescue!
For every field where you can choose from a list of predefined values in the interface of MyST Studio, there is a small slider button which simply reads ‘RAW’. When this is blue, you are able to fill in any value you like and are not bound to the supplied list of values.
We need to use this ability to set another value: None.
I think this value should have been part of the list in the GUI, but it apparently didn’t make the cut. So now we are forced to use the RAW value, which is slightly less intuitive, but equally functional.
MyST Studio and WebLogic currently support these (Raw) values for the Transaction field:
When this Transaction field is set to None and you perform an Update or Reprovision of your domain, it modifies your JDBC Data Source transaction specs to not support Global Transactions and shows up like this:
Just what we needed!
Let’s hope this value gets added to the dropdown list, as this will make this trick with the RAW value obsolete, and our lives just a little bit easier.