mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
improved support for hive-jdbc
This commit is contained in:
@@ -26,6 +26,7 @@ import javax.sql.StatementEventListener;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.SQLFeatureNotSupportedException;
|
||||
import java.sql.Statement;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
@@ -87,7 +88,14 @@ public final class DruidConnectionHolder {
|
||||
} catch (UnsupportedOperationException e) {
|
||||
holdabilityUnsupported = true;
|
||||
LOG.warn("getHoldability unsupported", e);
|
||||
} catch (SQLFeatureNotSupportedException e) {
|
||||
holdabilityUnsupported = true;
|
||||
LOG.warn("getHoldability unsupported", e);
|
||||
} catch (SQLException e) {
|
||||
// bug fixed for hive jdbc-driver
|
||||
if ("Method not supported".equals(e.getMessage())) {
|
||||
holdabilityUnsupported = true;
|
||||
}
|
||||
LOG.warn("getHoldability error", e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,6 +52,7 @@ public interface JdbcConstants {
|
||||
public static final String HBASE = "hbase";
|
||||
|
||||
public static final String HIVE = "hive";
|
||||
public static final String HIVE_DRIVER = "org.apache.hive.jdbc.HiveDriver";
|
||||
|
||||
public static final String H2 = "h2";
|
||||
public static final String H2_DRIVER = "org.h2.Driver";
|
||||
|
||||
@@ -422,6 +422,8 @@ public final class JdbcUtils implements JdbcConstants {
|
||||
return JdbcConstants.DM_DRIVER;
|
||||
} else if (rawUrl.startsWith("jdbc:kingbase:")) {
|
||||
return JdbcConstants.KINGBASE_DRIVER;
|
||||
} else if (rawUrl.startsWith("jdbc:hive:")) {
|
||||
return JdbcConstants.HIVE_DRIVER;
|
||||
} else {
|
||||
throw new SQLException("unkow jdbc driver : " + rawUrl);
|
||||
}
|
||||
@@ -497,6 +499,8 @@ public final class JdbcUtils implements JdbcConstants {
|
||||
return JdbcConstants.KINGBASE;
|
||||
} else if (rawUrl.startsWith("jdbc:log4jdbc:")) {
|
||||
return LOG4JDBC;
|
||||
} else if (rawUrl.startsWith("jdbc:hive:")) {
|
||||
return HIVE;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user