- android - RelativeLayout 背景可绘制重叠内容
- android - 如何链接 cpufeatures lib 以获取 native android 库?
- java - OnItemClickListener 不起作用,但 OnLongItemClickListener 在自定义 ListView 中起作用
- java - Android 文件转字符串
我正在编写一个 JDBC 客户端来访问 Phoenix。我尝试了以下用于从表中创建、加载和检索数据的基本代码。我尝试比较版本并寻找问题,但我无法获得此异常的确切原因。这是一个错误,还是您有解释?
版本信息- Hbase:0.98.0.2.1.5.0;凤凰:凤凰-4.0
代码:
public class PheonixTest {
public static void main(String args[]) throws Exception {
String phoenixDriver = "org.apache.phoenix.jdbc.PhoenixDriver";
try {
Class.forName(phoenixDriver);
} catch (ClassNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
System.exit(1);
}
try {
Statement stmt = null;
ResultSet rset = null;
System.out.println("Connecting ... >");
Connection con = DriverManager
.getConnection("jdbc:phoenix:<zookeeper>");
System.out.println("In Connection Statement -- >");
stmt = con.createStatement();
stmt.executeUpdate("CREATE TABLE IF NOT EXISTS us_population_java2 ( state CHAR(2) NOT NULL, city VARCHAR NOT NULL, population BIGINT CONSTRAINT my_pk PRIMARY KEY (state, city));");
stmt.executeUpdate("upsert into us_population_java values ('NY','New York',8143197)");
stmt.executeUpdate("upsert into us_population_java values ('CA','Los Angeles',3844829)");
stmt.executeUpdate("upsert into us_population_java values ('NY','New York',8143197)");
stmt.executeUpdate("upsert into us_population_java values ('CA','Los Angeles',3844829)");
System.out.println("After Execute Update Statement -- >");
con.commit();
PreparedStatement statement = con
.prepareStatement("select * from us_population_java");
rset = statement.executeQuery();
while (rset.next()) {
System.out.println("In Print Statement -- >");
System.out.println(rset.getString("state"));
}
statement.close();
con.close();
} catch (Exception e) {
e.printStackTrace();
}
}
}
异常:
java.sql.SQLException: ERROR 2007 (INT09): Outdated jars. The following servers require an updated phoenix.jar to be put in the classpath of HBase: region=SYSTEM.CATALOG
at org.apache.phoenix.exception.SQLExceptionCode$Factory$1.newException(SQLExceptionCode.java:386)
at org.apache.phoenix.exception.SQLExceptionInfo.buildException(SQLExceptionInfo.java:145)
at org.apache.phoenix.query.ConnectionQueryServicesImpl.checkClientServerCompatibility(ConnectionQueryServicesImpl.java:994)
at org.apache.phoenix.query.ConnectionQueryServicesImpl.ensureTableCreated(ConnectionQueryServicesImpl.java:867)
at org.apache.phoenix.query.ConnectionQueryServicesImpl.createTable(ConnectionQueryServicesImpl.java:1213)
at org.apache.phoenix.query.DelegateConnectionQueryServices.createTable(DelegateConnectionQueryServices.java:112)
at org.apache.phoenix.schema.MetaDataClient.createTableInternal(MetaDataClient.java:1902)
at org.apache.phoenix.schema.MetaDataClient.createTable(MetaDataClient.java:744)
at org.apache.phoenix.compile.CreateTableCompiler$2.execute(CreateTableCompiler.java:186)
at org.apache.phoenix.jdbc.PhoenixStatement$2.call(PhoenixStatement.java:300)
at org.apache.phoenix.jdbc.PhoenixStatement$2.call(PhoenixStatement.java:292)
at org.apache.phoenix.call.CallRunner.run(CallRunner.java:53)
at org.apache.phoenix.jdbc.PhoenixStatement.executeMutation(PhoenixStatement.java:290)
at org.apache.phoenix.jdbc.PhoenixStatement.executeUpdate(PhoenixStatement.java:1180)
at org.apache.phoenix.query.ConnectionQueryServicesImpl$12.call(ConnectionQueryServicesImpl.java:1891)
at org.apache.phoenix.query.ConnectionQueryServicesImpl$12.call(ConnectionQueryServicesImpl.java:1860)
at org.apache.phoenix.util.PhoenixContextExecutor.call(PhoenixContextExecutor.java:77)
at org.apache.phoenix.query.ConnectionQueryServicesImpl.init(ConnectionQueryServicesImpl.java:1860)
at org.apache.phoenix.jdbc.PhoenixDriver.getConnectionQueryServices(PhoenixDriver.java:162)
at org.apache.phoenix.jdbc.PhoenixEmbeddedDriver.connect(PhoenixEmbeddedDriver.java:131)
at org.apache.phoenix.jdbc.PhoenixDriver.connect(PhoenixDriver.java:133)
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at com.go.check.PheonixTest.main(PheonixTest.java:29)
最佳答案
看起来您的版本不兼容:http://doc.mapr.com/display/MapR/Using+Apache+Phoenix+on+HBase .
在先决条件中Apache Phoenix version 4.0 requires HBase 0.98.1 or later.
您可以尝试降级 Phoenix 或升级 Hbase。
关于hadoop - 在 Phoenix JDBC 客户端中获取 SQLException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32764439/
我正在尝试从模板中的列表( )中提取值,但出现此错误: lists in Phoenix.HTML and templates may only contain integers represent
我正在阅读 Programming Phoenix 这本书,一切都很好,直到第 44 页要求我重新启动 Phoenix 服务器。 我用双 Ctrl + C 杀死了当前服务器,但是当我尝试再次运行 mi
我的应用程序和 api json 请求以及常规 html 都可以工作。我的路由器.ex defmodule MyApp.Router do use MyApp.Web, :router pip
我想在模板中将对象呈现为 JSON。我试过: 但是我得到一个错误 protocol Phoenix.HTML.Safe not implemented for %Ecto.Changeset{...
在 phoenix 框架的 View 中,在 div 元素内生成两个 span 元素的方法是什么? 最佳答案 为了做到这一点,可以只使用一个数组并将其作为 div 标签的值传递给内部,如下所示: de
我从 Rails 迁移,并希望这能在我的模板中工作? hello world 似乎没有一个条件得到呈现。如何实现这一目标? 谢
完成示例指南。本章中详细介绍的内容在我的应用程序中不起作用。看起来很简单的事情。我有一个视频模型: defmodule Rumbl.Video do use Rumbl.Web, :model
完成示例指南。本章中详细介绍的内容在我的应用程序中不起作用。看起来很简单的事情。我有一个视频模型: defmodule Rumbl.Video do use Rumbl.Web, :model
通过可选“inputs_for”输入的 Phoenix 嵌套表单导致 Controller 中的 map 无法通过验证。例如,一个帖子有评论。如果我想在创建帖子时为帖子添加评论,嵌套表单将如下所示:
我正在尝试在应用程序中实现不同的语言。所以我所做的是在 Session 的 db 中创建了 lang 变量,它保留了当前选择的语言。 问题是我正在通过更新操作调用和更新值: def update(co
我想在我的网站上实现一个典型的“记住我”功能,它需要一种方法来创建在遥远的 future 过期的 cookie。有没有办法在 Phoenix Framework 中创建它们? 最佳答案 只要给 coo
我正在制作一个多站点应用程序。我想在测试 Controller 之前在连接上设置请求主机。在 Rails 中,我们可以使用 before :each do request.env["HTTP_RE
我知道我可以通过包含以下内容来更新实时取景: if connected?(socket), do: :timer.send_interval(10000, self(), :click) 但是,有没有
Ruby on Rails 带有终端命令 rake routes . Phoenix 有类似的吗? 最佳答案 命令是 $ mix phoenix.routes 关于phoenix-framework
我正在尝试使用 addict包以在我的项目中进行身份验证,但是每当我尝试执行操作(注册、登录...)时,我的 POST 都会出现 CrossDomain 错误。 我已经尝试添加 cors_plug包来
我在 Phoenix 项目,和mix ecto.create , mix ecto.migrate , 和 mix ecto.drop都发出相同的错误: $ mix ecto.drop ==> tzd
在我的帖子模型上,我实现了一个简单的验证 def changeset(model, params \\ :empty) do model |> cast(params, @requ
这主要是为了测试目的,但是我怎样才能在 Heroku 上实现与 mix ecto.reset 相同的效果。这样的命令导致 FATAL: permission denied for database "
我们的 Web 应用程序目前在 C# 中运行在 Windows 和 IIS 上。我们严重依赖此环境中包含的 Windows 身份验证方案。启用 Windows 身份验证后,我们可以检测连接用户的身份,
在我的 Phoenix 应用程序中,我想对单个记录运行 get_by() Ecto 查询 - 但是,我要搜索的字段之一应该评估为 nil ,但 Phoenix/Ecto 禁止使用 nil 作为比较运算
我是一名优秀的程序员,十分优秀!