mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
support odps
This commit is contained in:
@@ -70,6 +70,7 @@ public interface JdbcConstants {
|
||||
* 阿里云odps
|
||||
*/
|
||||
public static final String ODPS = "odps";
|
||||
public static final String ODPS_DRIVER = "com.aliyun.odps.jdbc.OdpsDriver";
|
||||
|
||||
/**
|
||||
* Log4JDBC
|
||||
|
||||
@@ -381,7 +381,9 @@ public final class JdbcUtils implements JdbcConstants {
|
||||
} else if (rawUrl.startsWith("jdbc:fake:") || rawUrl.startsWith("jdbc:mock:")) {
|
||||
return "com.alibaba.druid.mock.MockDriver";
|
||||
} else if (rawUrl.startsWith("jdbc:postgresql:")) {
|
||||
return "org.postgresql.Driver";
|
||||
return POSTGRESQL_DRIVER;
|
||||
} else if (rawUrl.startsWith("jdbc:odps:")) {
|
||||
return ODPS_DRIVER;
|
||||
} else if (rawUrl.startsWith("jdbc:hsqldb:")) {
|
||||
return "org.hsqldb.jdbcDriver";
|
||||
} else if (rawUrl.startsWith("jdbc:db2:")) {
|
||||
@@ -461,6 +463,8 @@ public final class JdbcUtils implements JdbcConstants {
|
||||
return POSTGRESQL;
|
||||
} else if (rawUrl.startsWith("jdbc:hsqldb:") || rawUrl.startsWith("jdbc:log4jdbc:hsqldb:")) {
|
||||
return HSQL;
|
||||
} else if (rawUrl.startsWith("jdbc:odps:")) {
|
||||
return ODPS;
|
||||
} else if (rawUrl.startsWith("jdbc:db2:")) {
|
||||
return DB2;
|
||||
} else if (rawUrl.startsWith("jdbc:sqlite:")) {
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.alibaba.druid.bvt.utils;
|
||||
|
||||
import org.junit.Assert;
|
||||
|
||||
import com.alibaba.druid.util.JdbcConstants;
|
||||
import com.alibaba.druid.util.JdbcUtils;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
public class JdbcUtilsTest_for_odps extends TestCase {
|
||||
public void test_odps() throws Exception {
|
||||
Assert.assertEquals(JdbcConstants.ODPS_DRIVER, JdbcUtils.getDriverClassName("jdbc:odps:"));
|
||||
}
|
||||
public void test_odps_dbtype() throws Exception {
|
||||
Assert.assertEquals(JdbcConstants.ODPS, JdbcUtils.getDbType("jdbc:odps:", null));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user