1515 */
1616package io .seata .rm .datasource .util ;
1717
18+ import java .lang .reflect .Constructor ;
19+ import java .sql .Connection ;
20+ import java .sql .Driver ;
21+ import java .sql .SQLException ;
22+ import javax .sql .XAConnection ;
23+ import javax .transaction .xa .XAException ;
1824import com .alibaba .druid .util .JdbcUtils ;
1925import com .alibaba .druid .util .MySqlUtils ;
2026import com .alibaba .druid .util .PGUtils ;
2127import io .seata .rm .BaseDataSourceResource ;
28+ import io .seata .sqlparser .util .JdbcConstants ;
2229import org .mariadb .jdbc .MariaDbConnection ;
2330import org .mariadb .jdbc .MariaXaConnection ;
2431import org .slf4j .Logger ;
2532import org .slf4j .LoggerFactory ;
2633
27- import javax .sql .XAConnection ;
28- import javax .transaction .xa .XAException ;
29- import java .lang .reflect .Constructor ;
30- import java .sql .Connection ;
31- import java .sql .Driver ;
32- import java .sql .SQLException ;
33-
3434public class XAUtils {
3535
3636 private static final Logger LOGGER = LoggerFactory .getLogger (XAUtils .class );
@@ -44,11 +44,11 @@ public static XAConnection createXAConnection(Connection physicalConn, BaseDataS
4444 }
4545
4646 public static XAConnection createXAConnection (Connection physicalConn , Driver driver , String dbType ) throws SQLException {
47- if (JdbcUtils .MYSQL .equals (dbType )) {
47+ if (JdbcConstants .MYSQL .equals (dbType )) {
4848 return MySqlUtils .createXAConnection (driver , physicalConn );
4949 } else {
5050 switch (dbType ) {
51- case JdbcUtils .ORACLE :
51+ case JdbcConstants .ORACLE :
5252 try {
5353 // https://github.com/alibaba/druid/issues/3707
5454 // before Druid issue fixed, just make ORACLE XA connection in my way.
@@ -62,9 +62,9 @@ public static XAConnection createXAConnection(Connection physicalConn, Driver dr
6262 } catch (XAException xae ) {
6363 throw new SQLException ("create xaConnection error" , xae );
6464 }
65- case JdbcUtils .MARIADB :
65+ case JdbcConstants .MARIADB :
6666 return new MariaXaConnection ((MariaDbConnection )physicalConn );
67- case JdbcUtils .POSTGRESQL :
67+ case JdbcConstants .POSTGRESQL :
6868 return PGUtils .createXAConnection (physicalConn );
6969 default :
7070 throw new SQLException ("xa not support dbType: " + dbType );
0 commit comments