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.

What dependencies I need to use phoenix jdbc installed on hbase server.

Solved Go to solution

What dependencies I need to use phoenix jdbc installed on hbase server.

New Contributor

Hi,

I have hbase server that have Phoenix installed . It is using kerberos .

phoenix-4.2.0.2.2.4.2-2-client.jar phoenix-4.2.0.2.2.4.2-2-server.jar .

I am trying to write java code where I can use phoenix jdbc driver and write a simple sql " select * from emp " .

What are the POM dependencies I need for Phoenix ?

How should My connection string look like ? I am using :

conn = DriverManager.getConnection("jdbc:" + zookeeper + ":2181/hbase-secure:principal@default_domain.com:" + keytabPath);

where principal@default_domain.com : krb.principal

1 ACCEPTED SOLUTION

Accepted Solutions

Re: What dependencies I need to use phoenix jdbc installed on hbase server.

The JDBC URL for Phoenix with Kerberos is of the form:

jdbc:phoenix:<Zookeeper_host_name>:<port_number>:<secured_Zookeeper_node>:<principal_name>:<HBase_headless_keytab_file>

You should only need the phoenix-client.jar on the classpath for your Java application for dependencies. You will likely also need the Hadoop and HBase configuration file directories (/etc/hadoop/conf and /etc/hbase/conf) on your classpath for Kerberos authentication to work properly.

9 REPLIES 9

Re: What dependencies I need to use phoenix jdbc installed on hbase server.

The JDBC URL for Phoenix with Kerberos is of the form:

jdbc:phoenix:<Zookeeper_host_name>:<port_number>:<secured_Zookeeper_node>:<principal_name>:<HBase_headless_keytab_file>

You should only need the phoenix-client.jar on the classpath for your Java application for dependencies. You will likely also need the Hadoop and HBase configuration file directories (/etc/hadoop/conf and /etc/hbase/conf) on your classpath for Kerberos authentication to work properly.

Re: What dependencies I need to use phoenix jdbc installed on hbase server.

New Contributor

I get Malformed connection url error from ConnectionInfo class : PhoenixEmbeddedDriver , when i use above url suggestion , not sure what I am doing wrong . Removing credentials for obvious reasons and replacing just names of server and principal .

jdbc:phoenix:d001.unix.gsm1900.org,d002.unix.gsm1900.org,d003.unix.gsm1900.org:2181:/hbase-secure:srvc@DEFAULT_DEV.com:/home/myname/krb/hdpsrvc.keytab

Re: What dependencies I need to use phoenix jdbc installed on hbase server.

New Contributor

Error : It enters this loop since it has more than 3 tokens . The code is fine with first 3 tokens but not more than that.protected static ConnectionInfo create(String url) { ........

if (!isMalformedUrl) { if (tokenizer.hasMoreTokens() && !TERMINATOR.equals(token)) { isMalformedUrl = true; } else if (i > 1)

Re: What dependencies I need to use phoenix jdbc installed on hbase server.

Can you share the entire exception (with stack trace), please?

I ran the parsing code from HDP 2.2.4.2 by hand with the URL you provided and it correctly parsed out the tokens:

[d001.unix.gsm1900.org,d002.unix.gsm1900.org,d003.unix.gsm1900.org, 2181, /hbase-secure, srvc@DEFAULT_DEV.com, /home/myname/krb/hdpsrvc.keytab]

Make sure to double check that the URL you provided here is also the same as the one in your code.

Re: What dependencies I need to use phoenix jdbc installed on hbase server.

New Contributor

I think i am not having correct dependency , what maven dependency should i use for phoenix-client.jar . i used phoenix , incubating 4.0 version and it gives above error. When i explicitly add jar then it causes other kerberose issue , which is wrong.

Re: What dependencies I need to use phoenix jdbc installed on hbase server.

You should use the same version of the dependency that you are running your code against: 4.2.0.2.2.4.2-2. For compile-time, you would want to use phoenix-core which will transitively include the necessary artifacts.

http://repo.hortonworks.com/content/groups/public/org/apache/phoenix/phoenix-core/4.2.0.2.2.4.2-2/ is the specific version of the artifact. You can configure this as a repository in your ~/.m2/settings.xml. Follow this Maven guide for more information

https://maven.apache.org/guides/mini/guide-multiple-repositories.html

Highlighted

Re: What dependencies I need to use phoenix jdbc installed on hbase server.

New Contributor

thank you . It works now . I was missing maven dependency .

steps : in pom.xml I added

<repositories> <repository> <id>repo.hortonworks.com</id> <name>Hortonworks HDP Maven Repository</name> <url>http://repo.hortonworks.com/content/repositories/releases/</url> </repository> </repositories>

<dependency> <groupId>org.apache.phoenix</groupId> <artifactId>phoenix-core</artifactId> <version>4.2.0.2.2.4.2-2</version> </dependency>

My connection url :

conn = DriverManager.getConnection("jdbc:phoenix:" + zookeeperQuorum + ":" + port + ":" + "/hbase-secure" + ":" + krb_principal + ":" + kerberosKeytab);

Re: What dependencies I need to use phoenix jdbc installed on hbase server.

New Contributor

Hey Guys,

I get below error when i use keytab path as below for phoenix jdbc connection . Can anyone please help me here . I have keytab file locally on my laptop.

keytab.path=C\:\\Users\\VBorhad\\krbProperties\\hdpsrvc.keytab

Error :

java.sql.SQLException: ERROR 102 (08001): Malformed connection url. jdbc:phoenix:p006.unix.gsm1900.org,p001.unix.gsm1900.org,p002.unix.gsm1900.org,p003.unix.gsm1900.org:2181:/hbase-secure:srvc@HDP_EIT_DEV.com:C:\Users\VBorhad\krbProperties\hdpsrvc.keytab at org.apache.phoenix.exception.SQLExceptionCode$Factory$1.newException(SQLExceptionCode.java:337) at org.apache.phoenix.exception.SQLExceptionInfo.buildException(SQLExceptionInfo.java:133)

Re: What dependencies I need to use phoenix jdbc installed on hbase server.

I saw you had already asked this question over at https://community.hortonworks.com/questions/7887/phoenix-throws-malformed-url-error-when-keytab-pat..... Let's address this issue there. Thanks.

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