Community Articles

Find and share helpful community-sourced technical articles.
avatar
Master Collaborator

In this article, we will learn how to integrate Zeppelin JDBC (Phoenix) interpreter example.

 

1. Configuring the JDBC (Phoenix) interpreter:
Login to Zeppelin UI -> Click on the user name (in my case, admin) at the right-hand corner. It will display a menu > click on Interpreter.

Screenshot 2021-12-06 at 4.52.00 PM.png

 

Click on + Create at the right-hand side of the screen.

 

Screenshot 2021-12-06 at 4.55.54 PM.png

 

It will display a popup menu. Enter Interpreter Name as jdbc and select Interpreter Group as jdbc. Then, it will populate Properties in table format. 

 

Screenshot 2021-12-06 at 4.58.39 PM.png

 

Click on + button and add the Phoenix-related properties according to your cluster, and click on the Save button.

phoenix.driver org.apache.phoenix.jdbc.PhoenixDriver
phoenix.url jdbc:phoenix:localhost:2181:/hbase
phoenix.user  
phoenix.password   

 

Screenshot 2021-12-06 at 5.13.11 PM.png

 

2. Creating the Notebook:

 

Click Notebook dropdown menu in the top left-hand corner and select Create new note and enter Note Name as Phoenix_Test,and select Default Interpreter as jdbc. Finally, click on Create button.

 

3. Running the Phoenix queries using jdbc (Phoenix) interpreter in Notebook:

 

 

%jdbc(phoenix)

CREATE TABLE IF NOT EXISTS Employee (
    id INTEGER PRIMARY KEY,
    name VARCHAR(225),
    salary FLOAT
)

%jdbc(phoenix)

UPSERT INTO Employee VALUES(1, 'Ranga Reddy', 24000)

%jdbc(phoenix)

UPSERT INTO Employee (id, name, salary) VALUES(2, 'Nishantha', 10000)

%jdbc(phoenix)

select * from Employee

 

 


4. Final Results:

Screenshot 2021-12-06 at 4.42.23 PM.png

 

Happy Learning.

1,143 Views