phoenix java game_使用Intellij-idea创建Phoenix JDBC连接

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

使用教程

保证sqlline-thin.py host能正常连接phoenix-queryserver

假设phoenix-queryserver主机在host4.demo.com主机中[root@storm2 bin]# ./sqlline-thin.py host4.demo.com

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 http://www.slf4j.org/codes.html#multiple_bindings 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 jdbc:phoenix:thin:url=http://host4.demo.com:8765;serialization=PROTOBUF;authentication=SPNEGO none none org.apache.phoenix.queryserver.client.DriverConnecting to jdbc:phoenix:thin:url=http://host4.demo.com:8765;serialization=PROTOBUF;authentication=SPNEGOConnected to: Apache Phoenix (version unknown version)

Driver: Phoenix Remote JDBC Driver (version unknown version)

Autocommit status: trueTransaction 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.00: jdbc:phoenix:thin:url=http://host4.demo>

IDEA配置database

点击设置图标

AAffA0nNPuCLAAAAAElFTkSuQmCC

点击设置图标

新增左上角加号添加Driver

配置如下

AAffA0nNPuCLAAAAAElFTkSuQmCC

image.png

选择Class:org.apache.phoenix.queryserver.client.Driver

Additional files:添加包 phoenix-5.0.0-HBase-2.0-thin-client.jar

添加URL templates:jdbc:phoenix:thin:url=http://{host::host4.demo.com}:8765;serialization=PROTOBUF;authentication=SPNEGO;principal=hbase@DEMO.COM;keytab=/etc/security/keytabs/hbase.headless.keytab

PS:请根据自己的配置进行修改

点击OK即可进行连接查询

SUCCESS

AAffA0nNPuCLAAAAAElFTkSuQmCC

image.png

作者:dounine

链接:https://www.jianshu.com/p/1a76bbe4a33f

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值