Reputation: 449
I am writing a JDBC Client to access Phoenix. I tried the following basic code for to Create, load and retrieve data from a Table. I tried comparing versions and looking for Issues, but I couldn't get the exact reason for this Exception. Is this a bug, or do you have an explanation?
Version Info- Hbase: 0.98.0.2.1.5.0 ; Phoenix: phoenix-4.0
Code:
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();
}
}
}
Exception:
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)
Upvotes: 2
Views: 1591
Reputation: 106
Looks like your versions are incompatible: http://doc.mapr.com/display/MapR/Using+Apache+Phoenix+on+HBase.
In prereqsApache Phoenix version 4.0 requires HBase 0.98.1 or later.
You could try downgrading your Phoenix or upgrading your Hbase.
Upvotes: 1