Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

Connection via Java program hangs while connecting phoenix on CDH 5.5 dockerized Quickstart

Highlighted

Connection via Java program hangs while connecting phoenix on CDH 5.5 dockerized Quickstart

Explorer

Hello,
I have dockerized Quickstart CDH 5.5 installation on my machine with parcelled phoenix installation which works fine. I am able to create tables, insert/update rows in phoenix tables via command phoenix-sqlline.py localhost:2181
However when I attempt connecting same via Java program it just clocks.

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

public class PhoenixConnector {

    public static void main(String[] args) {
        System.out.println("START PhoenixConnector");
        try{
            Class.forName("org.apache.phoenix.jdbc.PhoenixDriver").newInstance();
            Connection conn = DriverManager.getConnection("jdbc:phoenix:192.168.99.100:2181","","");
            //Control does not go beyond the above line. Also instead of docker ip (192.168.99.100) 
            //I also tried localhost but no help.
            Statement stmt = conn.createStatement();
            ResultSet rs = stmt.executeQuery("select * from US_POPULATION");
            while (rs.next())
                System.out.println("Name= " + rs.getString("host"));
        }
        catch(Exception e){
            System.out.println(e.getMessage());
        }
    }
}

Can you please help me understand what is going on?

Note: Program has required dependencies and it builds fine. 

Don't have an account?
Coming from Hortonworks? Activate your account here