improved support for hive-jdbc

This commit is contained in:
shaojin.wensj
2015-07-05 23:55:21 +08:00
parent 5fe6aa847e
commit 5459e967fc
3 changed files with 13 additions and 0 deletions
@@ -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;
}