Commit 9ed962a3 authored by Baoqi's avatar Baoqi
Browse files

add Microsoft SQL Server support

parent 2d3b7baa
Loading
Loading
Loading
Loading
+11 −1
Original line number Diff line number Diff line
@@ -210,6 +210,7 @@ public class DataSourceService extends BaseService{

        switch (dataSource.getType()) {
            case HIVE:
            case SQLSERVER:
                separator = ";";
                break;
            case MYSQL:
@@ -376,6 +377,10 @@ public class DataSourceService extends BaseService{
                    datasource = JSONObject.parseObject(parameter, OracleDataSource.class);
                    Class.forName(Constants.COM_ORACLE_JDBC_DRIVER);
                    break;
                case SQLSERVER:
                    datasource = JSONObject.parseObject(parameter, SQLServerDataSource.class);
                    Class.forName(Constants.COM_SQLSERVER_JDBC_DRIVER);
                    break;
                default:
                    break;
            }
@@ -447,7 +452,9 @@ public class DataSourceService extends BaseService{
                || Constants.CLICKHOUSE.equals(type.name())
                || Constants.ORACLE.equals(type.name())) {
            separator = "&";
        } else if (Constants.HIVE.equals(type.name()) || Constants.SPARK.equals(type.name())) {
        } else if (Constants.HIVE.equals(type.name())
                || Constants.SPARK.equals(type.name())
                || Constants.SQLSERVER.equals(type.name())) {
            separator = ";";
        }

@@ -502,6 +509,9 @@ public class DataSourceService extends BaseService{
        } else if (Constants.ORACLE.equals(type.name())) {
            sb.append(Constants.JDBC_ORACLE);
            sb.append(host).append(":").append(port);
        } else if (Constants.SQLSERVER.equals(type.name())) {
            sb.append(Constants.JDBC_SQLSERVER);
            sb.append(host).append(":").append(port);
        }

        return sb.toString();
+3 −0
Original line number Diff line number Diff line
@@ -84,6 +84,7 @@ public class Constants {
    public static final String ORG_APACHE_HIVE_JDBC_HIVE_DRIVER = "org.apache.hive.jdbc.HiveDriver";
    public static final String COM_CLICKHOUSE_JDBC_DRIVER = "ru.yandex.clickhouse.ClickHouseDriver";
    public static final String COM_ORACLE_JDBC_DRIVER = "oracle.jdbc.driver.OracleDriver";
    public static final String COM_SQLSERVER_JDBC_DRIVER = "com.microsoft.sqlserver.jdbc.SQLServerDriver";

    /**
     * database type
@@ -94,6 +95,7 @@ public class Constants {
    public static final String SPARK = "SPARK";
    public static final String CLICKHOUSE = "CLICKHOUSE";
    public static final String ORACLE = "ORACLE";
    public static final String SQLSERVER = "SQLSERVER";

    /**
     * jdbc url
@@ -103,6 +105,7 @@ public class Constants {
    public static final String JDBC_HIVE_2 = "jdbc:hive2://";
    public static final String JDBC_CLICKHOUSE = "jdbc:clickhouse://";
    public static final String JDBC_ORACLE = "jdbc:oracle:thin:@//";
    public static final String JDBC_SQLSERVER = "jdbc:sqlserver://";


    public static final String ADDRESS = "address";
+11 −0
Original line number Diff line number Diff line
@@ -386,6 +386,17 @@
				</exclusion>
			</exclusions>
		</dependency>

		<dependency>
			<groupId>com.microsoft.sqlserver</groupId>
			<artifactId>mssql-jdbc</artifactId>
			<exclusions>
				<exclusion>
					<artifactId>com.microsoft.azure</artifactId>
					<groupId>azure-keyvault</groupId>
				</exclusion>
			</exclusions>
		</dependency>
	</dependencies>


+5 −0
Original line number Diff line number Diff line
@@ -621,6 +621,11 @@ public final class Constants {
     */
    public static final String JDBC_ORACLE_CLASS_NAME = "oracle.jdbc.driver.OracleDriver";

    /**
     * Oracle
     */
    public static final String JDBC_SQLSERVER_CLASS_NAME = "com.microsoft.sqlserver.jdbc.SQLServerDriver";

    /**
     * spark params constant
     */
+2 −1
Original line number Diff line number Diff line
@@ -27,6 +27,7 @@ public enum DbType {
   * 3 spark
   * 4 clickhouse
   * 5 oracle
   * 6 sqlserver
   */
  MYSQL, POSTGRESQL, HIVE, SPARK, CLICKHOUSE, ORACLE
  MYSQL, POSTGRESQL, HIVE, SPARK, CLICKHOUSE, ORACLE, SQLSERVER
}
Loading