Reply
Highlighted
sph
Explorer
Posts: 10
Registered: ‎03-15-2016

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

[ Edited ]

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.