[
https://issues.apache.org/jira/browse/PHOENIX-5953?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Lars Hofhansl resolved PHOENIX-5953.
------------------------------------
Resolution: Not A Problem
> Set CurrentSCN value can not write data
> ---------------------------------------
>
> Key: PHOENIX-5953
> URL: https://issues.apache.org/jira/browse/PHOENIX-5953
> Project: Phoenix
> Issue Type: Bug
> Components: connectors, core
> Affects Versions: 4.14.0
> Environment: <dependency>
> <groupId>org.apache.phoenix</groupId>
> <artifactId>phoenix-core</artifactId>
> <version>4.14.0-HBase-1.3</version>
> </dependency>
> Reporter: liqi316
> Priority: Major
>
> I want to write data to hbase by pheonix, and set data ttl,my code like this:
>
> {code:java}
> //代码占位符
> public void getConncetion() throws SQLException {
> Properties info = new Properties();
> if(dataTTL > 0) {
> info.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB,
> Long.toString(System.currentTimeMillis() - dataTTL));
> }
> if (userName != null) {
> info.put("user", userName);
> }
> if (password != null) {
> info.put("password", password);
> }
> connection = (Connection) DriverManager.getConnection(dbUrl, info);
> connection.setAutoCommit(true);
> }
> connection.createStatement().execute("UPSERT INTO
> ZXVMAX.\"waterdrop_phonex_test\"(\"NAME\", \"AGE\") values('test', "+
> System.currentTimeMillis() +")");
> {code}
> but it can not write.The Exception :
> info: write to Hbase failed......sql:UPSERT INTO
> ZXVMAX."waterdrop_phonex_test"("NAME", "AGE")
> values(?,?)java.sql.SQLException: ERROR 518 (25502): Mutations are not
> permitted for a read-only connection. at
> org.apache.phoenix.exception.SQLExceptionCode$Factory$1.newException(SQLExceptionCode.java:494)
> at
> org.apache.phoenix.exception.SQLExceptionInfo.buildException(SQLExceptionInfo.java:150)
> at
> org.apache.phoenix.jdbc.PhoenixStatement.executeMutation(PhoenixStatement.java:383)
> at
> org.apache.phoenix.jdbc.PhoenixStatement.executeMutation(PhoenixStatement.java:378)
> at
> org.apache.phoenix.jdbc.PhoenixStatement.execute(PhoenixStatement.java:1825)
> at
> io.github.interestinglab.waterdrop.flink.sink.HBasePhoenixSink.invoke(HBasePhoenixSink.java:100)
> at
> io.github.interestinglab.waterdrop.flink.sink.HBasePhoenixSink.invoke(HBasePhoenixSink.java:15)
> at
> org.apache.flink.streaming.api.operators.StreamSink.processElement(StreamSink.java:56)
> at
> org.apache.flink.streaming.runtime.tasks.OperatorChain$CopyingChainingOutput.pushToOperator(OperatorChain.java:637)
> at
> org.apache.flink.streaming.runtime.tasks.OperatorChain$CopyingChainingOutput.collect(OperatorChain.java:612)
> at
> org.apache.flink.streaming.runtime.tasks.OperatorChain$CopyingChainingOutput.collect(OperatorChain.java:592)
> at
> org.apache.flink.streaming.api.operators.AbstractStreamOperator$CountingOutput.collect(AbstractStreamOperator.java:727)
> at
> org.apache.flink.streaming.api.operators.AbstractStreamOperator$CountingOutput.collect(AbstractStreamOperator.java:705)
> at
> org.apache.flink.streaming.api.operators.StreamMap.processElement(StreamMap.java:41)
> ..........
>
--
This message was sent by Atlassian Jira
(v8.3.4#803005)