Hi,
The main cause is that you put inappropriate props key value for the parameter.
What properties would you expect to utilize at the phoenix connection time ?
Thanks,
Sun
CertusNet
发件人: chenwenhui
发送时间: 2014-12-04 13:49
收件人: user
主题: Phoenix4.2.1 against HBase0.98.6 encountered a strange problem when using
connection with props
The main code fragment is as follow:
final Properties props = new Properties();
final long ts = 1417597200000L;
props.put(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts));
Class.forName("org.apache.phoenix.jdbc.PhoenixDriver");
final Connection con =
DriverManager.getConnection("jdbc:phoenix:192.168.15.48", props);
stmt = con.createStatement();
stmt.executeUpdate("upsert into mytest1 values(3,'abc')");
con.commit();
con.close();
It will report the following exception:
Exception in thread "main" org.apache.phoenix.schema.TableNotFoundException:
ERROR 1012 (42M03): Table undefined. tableName=MYTEST1
at
org.apache.phoenix.compile.FromCompiler$BaseColumnResolver.createTableRef(FromCompiler.java:325)
at
org.apache.phoenix.compile.FromCompiler$SingleTableColumnResolver.<init>(FromCompiler.java:215)
at
org.apache.phoenix.compile.FromCompiler$SingleTableColumnResolver.<init>(FromCompiler.java:209)
at
org.apache.phoenix.compile.FromCompiler.getResolverForMutation(FromCompiler.java:185)
at org.apache.phoenix.compile.UpsertCompiler.compile(UpsertCompiler.java:246)
at
org.apache.phoenix.jdbc.PhoenixStatement$ExecutableUpsertStatement.compilePlan(PhoenixStatement.java:478)
at
org.apache.phoenix.jdbc.PhoenixStatement$ExecutableUpsertStatement.compilePlan(PhoenixStatement.java:469)
at org.apache.phoenix.jdbc.PhoenixStatement$2.call(PhoenixStatement.java:270)
at org.apache.phoenix.jdbc.PhoenixStatement$2.call(PhoenixStatement.java:263)
at org.apache.phoenix.call.CallRunner.run(CallRunner.java:53)
at
org.apache.phoenix.jdbc.PhoenixStatement.executeMutation(PhoenixStatement.java:261)
at
org.apache.phoenix.jdbc.PhoenixStatement.executeUpdate(PhoenixStatement.java:1043)
at com.bitauto.phoenix.FirstTest.main(FirstTest.java:40)
But the table named MYTEST1 indeed exists, and if using connection without
props, i.e.
Connection con = DriverManager.getConnection("jdbc:phoenix:192.168.15.48";
all things will become okay.
Any ideas can be appreciated!