add xa support

This commit is contained in:
wenshao
2012-08-21 09:29:26 +08:00
parent 9142e8cc04
commit 2c397caf42
2 changed files with 9 additions and 3 deletions
@@ -65,6 +65,10 @@ public class DruidXADataSource extends DruidDataSource implements XADataSource {
if (JdbcUtils.H2.equals(dbType)) {
return H2Utils.createXAConnection(h2Factory, physicalConn);
}
if (JdbcUtils.JTDS.equals(dbType)) {
return new JtdsXAConnection(physicalConn);
}
throw new SQLException("xa not support dbType : " + this.dbType);
}
@@ -47,6 +47,8 @@ import com.alibaba.druid.support.logging.LogFactory;
*/
public final class JdbcUtils {
public static final String JTDS = "jtds";
public static final String MOCK = "mock";
public static final String HSQL = "hsql";
@@ -443,7 +445,7 @@ public final class JdbcUtils {
} else if (rawUrl.startsWith("jdbc:sybase:Tds:")) {
return SYBASE;
} else if (rawUrl.startsWith("jdbc:jtds:")) {
return "jtds";
return JTDS;
} else if (rawUrl.startsWith("jdbc:fake:") || rawUrl.startsWith("jdbc:mock:")) {
return MOCK;
} else if (rawUrl.startsWith("jdbc:postgresql:")) {
@@ -510,7 +512,7 @@ public final class JdbcUtils {
throw new SQLException(e.getMessage(), e);
}
}
public static int executeUpdate(DataSource dataSource, String sql, Object... parameters) throws SQLException {
return executeUpdate(dataSource, sql, Arrays.asList(parameters));
}
@@ -649,7 +651,7 @@ public final class JdbcUtils {
return null;
}
}
public static void insertToTable(DataSource dataSource, String tableName, Map<String, Object> data)
throws SQLException {
Connection conn = null;