您的当前位置:首页正文

使用Intellij-idea创建Phoenix JDBC连接

来源:花图问答

Phoenix中我们可以使用Phoenix 的sqlline.py进行连接操作,但是界面只是控制台,查看数据很不直观,SQL语句也没有提示,我们如何在IDEA中的database工具栏中直接连接Phoenix呢,这就是此文要记录的。

使用教程

[root@storm2 bin]# ./sqlline-thin.py 
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/bigdata/phoenix/phoenix-5.0.0-HBase-2.0-thin-client.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/usr/hdp/3.0.0.0-1634/hadoop/lib/slf4j-log4j12-1.7.25.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See  for an explanation.
18/08/22 22:24:41 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
Setting property: [incremental, false]
Setting property: [isolation, TRANSACTION_READ_COMMITTED]
issuing: !connect  none none org.apache.phoenix.queryserver.client.Driver
Connecting to 
Connected to: Apache Phoenix (version unknown version)
Driver: Phoenix Remote JDBC Driver (version unknown version)
Autocommit status: true
Transaction isolation: TRANSACTION_READ_COMMITTED
Building list of tables and columns for tab-completion (set fastconnect to true to skip)...
192/192 (100%) Done
Done
sqlline version 1.2.0
0: jdbc:phoenix:thin:url=http://host4.demo>

IDEA配置database
点击设置图标

点击设置图标

新增左上角加号添加Driver
配置如下

image.png

点击OK即可进行连接查询

SUCCESS

image.png