Merge pull request #4754 from wl861106/master

Add dbcp driver support
This commit is contained in:
温绍锦
2022-04-25 00:15:08 +08:00
committed by GitHub
5 changed files with 18 additions and 2 deletions
@@ -105,6 +105,9 @@
{
"value": "kingbase"
},
{
"value": "tydb"
},
{
"value": "oceanbase"
},
@@ -171,6 +174,9 @@
{
"value": "kingbase"
},
{
"value": "tydb"
},
{
"value": "oceanbase"
},
@@ -201,4 +207,4 @@
]
}
]
}
}
+3 -1
View File
@@ -61,7 +61,9 @@ public enum DbType {
oscar (1 << 40),
tidb ( 1 << 41),
tydb ( 1 << 42),
ingres (0),
cloudscape (0),
timesten (0),
@@ -152,4 +152,6 @@ public interface JdbcConstants {
DbType OSCAR = DbType.oscar;
String OSCAR_DRIVER = "com.oscar.Driver";
DbType TYDB = DbType.tydb;
String TYDB_DRIVER = "com.dbcp.jdbc.Driver";
}
@@ -529,6 +529,8 @@ public final class JdbcUtils implements JdbcConstants {
return "com.highgo.jdbc.Driver";
} else if (rawUrl.startsWith("jdbc:oscar")) {
return JdbcConstants.OSCAR_DRIVER;
} else if (rawUrl.startsWith("jdbc:dbcp:")) {
return JdbcConstants.TYDB_DRIVER;
} else {
throw new SQLException("unknown jdbc driver : " + rawUrl);
}
@@ -32,4 +32,8 @@ public class JdbcUtilsTest2 extends TestCase {
public void test_kdb() throws Exception {
assertEquals(JdbcConstants.KDB_DRIVER, JdbcUtils.getDriverClassName("jdbc:inspur:"));
}
public void test_tydb() throws Exception {
assertEquals(JdbcConstants.TYDB_DRIVER, JdbcUtils.getDriverClassName("jdbc:dbcp:"));
}
}