[chore][fix](httpv2) Use mariadb-java-client for http query api (#8716)

In #8319, I remove mysql-connector-java dependency because of license incompatibility.
But we need a mysql compatible driver for http query api. So I choose mariadb-java-client,
which is under LGPL.
This commit is contained in:
Mingyu Chen
2022-03-30 09:59:45 +08:00
committed by GitHub
parent 76e0634030
commit b98da02611
6 changed files with 522 additions and 5 deletions

View File

@ -69,8 +69,8 @@ public class StatementSubmitter {
private static final String TYPE_RESULT_SET = "result_set";
private static final String TYPE_EXEC_STATUS = "exec_status";
private static final String JDBC_DRIVER = "com.mysql.jdbc.Driver";
private static final String DB_URL_PATTERN = "jdbc:mysql://127.0.0.1:%d/%s";
private static final String JDBC_DRIVER = "org.mariadb.jdbc.Driver";
private static final String DB_URL_PATTERN = "jdbc:mariadb://127.0.0.1:%d/%s";
private ThreadPoolExecutor executor = ThreadPoolManager.newDaemonCacheThreadPool(2, "SQL submitter", true);
@ -102,8 +102,8 @@ public class StatementSubmitter {
long startTime = System.currentTimeMillis();
if (stmtBase instanceof QueryStmt || stmtBase instanceof ShowStmt) {
stmt = conn.prepareStatement(queryCtx.stmt, ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
// set fetch size to MIN_VALUE to enable streaming result set to avoid OOM.
((PreparedStatement) stmt).setFetchSize(Integer.MIN_VALUE);
// set fetch size to 1 to enable streaming result set to avoid OOM.
((PreparedStatement) stmt).setFetchSize(1);
ResultSet rs = ((PreparedStatement) stmt).executeQuery();
ExecutionResultSet resultSet = generateResultSet(rs, startTime);
rs.close();