Java JDBC Hive Connection getConnection()

Here you can find the source of getConnection()

Description

get Connection

License

Apache License

Declaration

public static Connection getConnection() 

Method Source Code


//package com.java2s;
//License from project: Apache License 

import java.sql.*;

public class Main {
    public static String driver = "org.apache.hive.jdbc.HiveDriver";
    public static String url = "jdbc:hive2://172.16.19.156:10000/default";

    public static Connection getConnection() {
        try {//from   www .  j  a  v  a2 s.c om
            Class.forName(driver);
            return DriverManager.getConnection(url, "", "");
        } catch (SQLException e) {
            e.printStackTrace();
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        }
        return null;
    }
}

Related

  1. getConnection()