All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.panhongan.util.hive.HiveUtil Maven / Gradle / Ivy

There is a newer version: 0.1.8
Show newest version
package com.github.panhongan.util.hive;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.github.panhongan.util.conf.Config;
import com.github.panhongan.util.sql.SqlUtil;
import com.mchange.v2.c3p0.ComboPooledDataSource;

public class HiveUtil {
	
	private static final Logger logger = LoggerFactory.getLogger(HiveUtil.class);
	
	private static final String HIVE_DRIVER = "org.apache.hadoop.hive.jdbc.HiveDriver";
	
	private static final String SOURCE_TYPE = "hive";
	
	public static HiveSession createHiveSession(String hive_conf_file) throws SQLException {
		Config conf = new Config();
		conf.parse(hive_conf_file);
		return new HiveSession(SqlUtil.createConnection(conf));
	}
	
	public static HiveSession createHiveSession(Config conf) throws SQLException {
		return new HiveSession(SqlUtil.createConnection(conf));
	}
	
	public static void closeHiveSession(HiveSession session) {
		if (session != null) {
			session.close();
		}
	}
	

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy