private static final Logger log = LoggerFactory.getLogger(JdbcUtil.class.getName()); //替换成自己的jdbc的url private static final String URL = "jdbc:phoenix: 192.168.1.1:9099"; private static final String PHOENIX_DRIVER = "org.apache.phoenix.jdbc.PhoenixDriver"; /** * 获取Phoenix连接 * * @param conf 权限配置 * @return Connection */ public static Connection getPhoenixConnection(Configuration conf) { Properties props = new Properties(); for (Map.Entry<String, String> entry : conf) { props.put(entry.getKey(), entry.getValue()); } try { return getJdbcConnection(PHOENIX_DRIVER, URL, props); } catch (Exception ex) { log.error(" JdbcUtil getPhoenixConnection fail {}", ex.getMessage()); } throw new RuntimeException("获取Phoenix连接异常"); }
Phoenix的JDBC连接
最新推荐文章于 2023-10-08 14:55:36 发布