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.

loading phoenix table using java

Solved Go to solution

loading phoenix table using java

Rising Star

I wanted to load a csv file into phoenix table using Java.

I need help on JDBC phoenix connection. I am getting lots of dependencies issue.

Can someone please help me on what are the jar files reuquired to establish a jdbc connection for phoenix

1 ACCEPTED SOLUTION

Accepted Solutions

Re: loading phoenix table using java

New Contributor

Hi @Dinesh Das,

I'm using Sandbox 2.6.1

Tips:

* You can find the phoenix version in the path: /usr/hdp/current/phoenix-client/lib/phoenix-core-{phoenix.version}.jar

* For testing purposes I'm using the following properties:

url: jdbc:phoenix:localhost:2181:/hbase-unsecure
driver-class-name: org.apache.phoenix.jdbc.PhoenixDriver
username: anything
password: anything

You need to add the following properties, dependencies and repositories to your pom file:

<properties> 
...  
<phoenix.version>4.7.0.2.6.1.0-129</phoenix.version>   
...
</properties>

<dependencies>
...
<dependency>
   <groupId>org.apache.phoenix</groupId>
   <artifactId>phoenix-core</artifactId>
   <version>${phoenix.version}</version>
</dependency>
...
</dependencies>

<repositories>
   <repository>
      <releases>
         <enabled>true</enabled>
      </releases>
      <snapshots>
         <enabled>false</enabled>
      </snapshots>
      <id>hortonworks.release.repo</id>
      <name>Hortonworks Release Repository</name>
      <url>http://repo.hortonworks.com/content/repositories/releases/</url>
   </repository>
   <repository>
      <releases>
         <enabled>true</enabled>
      </releases>
      <snapshots>
         <enabled>false</enabled>
      </snapshots>
      <id>hortonworks.third-party.artifacts.1</id>
      <name>Hortonworks third-party artifacts 1</name>
      <url>http://repo.hortonworks.com/content/repositories/jetty-hadoop/</url>
   </repository>
   <repository>
      <releases>
         <enabled>true</enabled>
      </releases>
      <snapshots>
         <enabled>false</enabled>
      </snapshots>
      <id>hortonworks.third-party.artifacts.2</id>
      <name>Hortonworks third-party artifacts 2</name>
      <url>http://repo.hortonworks.com/content/repositories/re-hosted/</url>
   </repository>
   <repository>
      <releases>
         <enabled>true</enabled>
      </releases>
      <snapshots>
         <enabled>false</enabled>
      </snapshots>
      <id>hortonworks.public.group.repo</id>
      <name>Hortonworks Public Group Repository</name>
      <url>http://repo.hortonworks.com/content/groups/public</url>
   </repository>
</repositories>

That's all you need :)

2 REPLIES 2

Re: loading phoenix table using java

New Contributor

Hi @Dinesh Das,

I'm using Sandbox 2.6.1

Tips:

* You can find the phoenix version in the path: /usr/hdp/current/phoenix-client/lib/phoenix-core-{phoenix.version}.jar

* For testing purposes I'm using the following properties:

url: jdbc:phoenix:localhost:2181:/hbase-unsecure
driver-class-name: org.apache.phoenix.jdbc.PhoenixDriver
username: anything
password: anything

You need to add the following properties, dependencies and repositories to your pom file:

<properties> 
...  
<phoenix.version>4.7.0.2.6.1.0-129</phoenix.version>   
...
</properties>

<dependencies>
...
<dependency>
   <groupId>org.apache.phoenix</groupId>
   <artifactId>phoenix-core</artifactId>
   <version>${phoenix.version}</version>
</dependency>
...
</dependencies>

<repositories>
   <repository>
      <releases>
         <enabled>true</enabled>
      </releases>
      <snapshots>
         <enabled>false</enabled>
      </snapshots>
      <id>hortonworks.release.repo</id>
      <name>Hortonworks Release Repository</name>
      <url>http://repo.hortonworks.com/content/repositories/releases/</url>
   </repository>
   <repository>
      <releases>
         <enabled>true</enabled>
      </releases>
      <snapshots>
         <enabled>false</enabled>
      </snapshots>
      <id>hortonworks.third-party.artifacts.1</id>
      <name>Hortonworks third-party artifacts 1</name>
      <url>http://repo.hortonworks.com/content/repositories/jetty-hadoop/</url>
   </repository>
   <repository>
      <releases>
         <enabled>true</enabled>
      </releases>
      <snapshots>
         <enabled>false</enabled>
      </snapshots>
      <id>hortonworks.third-party.artifacts.2</id>
      <name>Hortonworks third-party artifacts 2</name>
      <url>http://repo.hortonworks.com/content/repositories/re-hosted/</url>
   </repository>
   <repository>
      <releases>
         <enabled>true</enabled>
      </releases>
      <snapshots>
         <enabled>false</enabled>
      </snapshots>
      <id>hortonworks.public.group.repo</id>
      <name>Hortonworks Public Group Repository</name>
      <url>http://repo.hortonworks.com/content/groups/public</url>
   </repository>
</repositories>

That's all you need :)

Re: loading phoenix table using java

Rising Star

@Marco Almeida

Thank you for your help. I did try for various version of phoenix core but no luck

lemme try this..

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