I think you are missing create table statement. That's why getting 
TableNotFoundException.
Please check once..

________________________________
This e-mail and its attachments contain confidential information from HUAWEI, 
which
is intended only for the person or entity whose address is listed above. Any 
use of the
information contained herein in any way (including, but not limited to, total 
or partial
disclosure, reproduction, or dissemination) by persons other than the intended
recipient(s) is prohibited. If you receive this e-mail in error, please notify 
the sender by
phone or email immediately and delete it!
________________________________
From: chenwenhui [[email protected]]
Sent: Thursday, December 04, 2014 11:19 AM
To: [email protected]
Subject: 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!


Reply via email to