-
1. Re: ArjunaTS and MS SQL server 2000
marklittle Apr 15, 2006 6:18 PM (in response to xiaoqj)Even though you are using JBoss Transactions to manage two-phase (and possibly distributed) transactions amongst SQLServer instances, you still need to ensure that the SQLServer instance is capable of participating in the two-phase commit protocol. SQLServer accomplishes this by leveraging the DTC (essentially the DTC becomes the RM).
To do this, check http://msdn2.microsoft.com/en-US/library/ms378931.aspx for a start and read the xa_install.txt file that ships with the driver.
Let me know if this sorts things out for you.
Mark. -
2. Re: ArjunaTS and MS SQL server 2000
xiaoqj Apr 15, 2006 9:54 PM (in response to xiaoqj)That tutorial page helps a lot. 3x
The way that DTC and JBossTS inteoperate seems like another example of interposition.
Some suggestions about the com.arjuna.demo.jta.jdbcbank example:
1. the sql sentence in the "create_account()" method is wrong, where column name "accountName" should be corrected to "name"
2. the create_table() method is called every time the Bank is created, which is not suitable. For here the Bank object has a persistent backend storage. unlike the com.arjuna.demo.jta.localbank example. So rename the create_table() to create_table_if_not_exists(). The following code can do the judgement.
private boolean exists(Connection conn, String tableName) {
if (conn == null)
return false;
DatabaseMetaData md = null;
ResultSet rs = null;
try {
md = conn.getMetaData();
rs = md.getTables(null, null, "%", null);
while (rs.next()) {
String name = rs.getString(3);
if (name.equalsIgnoreCase(tableName))
return true;
}
} catch (Exception e) {
e.printStackTrace();
} finally {
if(rs != null)
try {
rs.close();
} catch (SQLException e) {
e.printStackTrace();
}
}
return false;
}
3. The Bank class acts as a facade to the back-end storage. Probably the tx.begin, tx.commit clauses should be put in Bank for explicitly tx demarcation, rather than in BankClient. If the user would like to do transfer across different banks, nested tx shall be introduced. -
3. Re: ArjunaTS and MS SQL server 2000
marklittle Apr 16, 2006 6:46 AM (in response to xiaoqj)You're right in that this is like interposition, with DTC acting as a subordinate coordinator.
We'll take a look at the suggestions on improvements (though nested transactions won't work here because we need this to run on databases that don't support them). However, I've registered an issue in JIRA (http://jira.jboss.com/jira/browse/JBTM-58) should you wish to track this.
Can you just confirm that you have now got the example running? -
4. Re: ArjunaTS and MS SQL server 2000
xiaoqj Apr 16, 2006 11:26 AM (in response to xiaoqj)3x u for help. My pleasure to do some contribution.