Description
Class.forName("org.apache.phoenix.queryserver.client.Driver"); Connection conn= DriverManager.getConnection("jdbc:phoenix:thin:url=http://192.168.0.1:8765;serialization=PROTOBUF"); String sqlerr=" SELECT TO_CHAR(TO_DATE(SUCCESS_TIME,?),'yyyy-MM-dd') as success, " + " COUNT(DISTINCT USER_ID) recharge_rs, " + " COUNT(ID) recharge_rc, " + " SUM(TO_NUMBER(ACTUAL_MONEY)) recharge_money " + " FROM RECHARGE " + " WHERE STATUS = 'success' AND RECHARGE_WAY != 'admin' " + " GROUP BY TO_CHAR(TO_DATE(SUCCESS_TIME,?),'yyyy-MM-dd') "; PreparedStatement pstmt = conn.prepareStatement(sqlerr); pstmt.setString(1, "yyyy-MM-dd"); pstmt.setString(2, "yyyy-MM-dd"); ResultSet rs = pstmt.executeQuery(); while (rs.next()) { System.out.println((rs.getString("success").toString())); }
====================================================================================================
AvaticaClientRuntimeException: Remote driver error: RuntimeException: java.sql.SQLException: ERROR 2004 (INT05): Parameter value unbound. Parameter at index 1 is unbound -> SQLException: ERROR 2004 (INT05): Parameter value unbound. Parameter at index 1 is unbound. Error -1 (00000) null java.lang.RuntimeException: java.sql.SQLException: ERROR 2004 (INT05): Parameter value unbound. Parameter at index 1 is unbound at org.apache.calcite.avatica.jdbc.JdbcMeta.propagate(JdbcMeta.java:683) at org.apache.calcite.avatica.jdbc.JdbcMeta.execute(JdbcMeta.java:880) at org.apache.calcite.avatica.remote.LocalService.apply(LocalService.java:254) at org.apache.calcite.avatica.remote.Service$ExecuteRequest.accept(Service.java:1032) at org.apache.calcite.avatica.remote.Service$ExecuteRequest.accept(Service.java:1002) at org.apache.calcite.avatica.remote.AbstractHandler.apply(AbstractHandler.java:94) at org.apache.calcite.avatica.remote.ProtobufHandler.apply(ProtobufHandler.java:46) at org.apache.calcite.avatica.server.AvaticaProtobufHandler.handle(AvaticaProtobufHandler.java:127) at org.apache.phoenix.shaded.org.eclipse.jetty.server.handler.HandlerList.handle(HandlerList.java:52) at org.apache.phoenix.shaded.org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97) at org.apache.phoenix.shaded.org.eclipse.jetty.server.Server.handle(Server.java:499) at org.apache.phoenix.shaded.org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:311) at org.apache.phoenix.shaded.org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:257) at org.apache.phoenix.shaded.org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java:544) at org.apache.phoenix.shaded.org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:635) at org.apache.phoenix.shaded.org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:555) at java.lang.Thread.run(Thread.java:748) Caused by: java.sql.SQLException: ERROR 2004 (INT05): Parameter value unbound. Parameter at index 1 is unbound at org.apache.phoenix.exception.SQLExceptionCode$Factory$1.newException(SQLExceptionCode.java:483) at org.apache.phoenix.exception.SQLExceptionInfo.buildException(SQLExceptionInfo.java:150) at org.apache.phoenix.jdbc.PhoenixParameterMetaData.getParam(PhoenixParameterMetaData.java:89) at org.apache.phoenix.jdbc.PhoenixParameterMetaData.isSigned(PhoenixParameterMetaData.java:138) at org.apache.calcite.avatica.jdbc.JdbcMeta.parameters(JdbcMeta.java:270) at org.apache.calcite.avatica.jdbc.JdbcMeta.signature(JdbcMeta.java:282) at org.apache.calcite.avatica.jdbc.JdbcMeta.execute(JdbcMeta.java:856) ... 15 more at org.apache.calcite.avatica.remote.Service$ErrorResponse.toException(Service.java:2476) at org.apache.calcite.avatica.remote.RemoteProtobufService._apply(RemoteProtobufService.java:63) at org.apache.calcite.avatica.remote.ProtobufService.apply(ProtobufService.java:97) at org.apache.calcite.avatica.remote.RemoteMeta$15.call(RemoteMeta.java:344) at org.apache.calcite.avatica.remote.RemoteMeta$15.call(RemoteMeta.java:342) at org.apache.calcite.avatica.AvaticaConnection.invokeWithRetries(AvaticaConnection.java:756) at org.apache.calcite.avatica.remote.RemoteMeta.execute(RemoteMeta.java:341) at org.apache.calcite.avatica.AvaticaConnection.executeQueryInternal(AvaticaConnection.java:511) at org.apache.calcite.avatica.AvaticaPreparedStatement.executeQuery(AvaticaPreparedStatement.java:133) at com.company.Main.main(Main.java:62) Exception in thread "main" org.apache.calcite.avatica.AvaticaSqlException: Error -1 (00000) : Remote driver error: RuntimeException: java.sql.SQLException: ERROR 2004 (INT05): Parameter value unbound. Parameter at index 1 is unbound -> SQLException: ERROR 2004 (INT05): Parameter value unbound. Parameter at index 1 is unbound at org.apache.calcite.avatica.Helper.createException(Helper.java:54) at org.apache.calcite.avatica.Helper.createException(Helper.java:41) at org.apache.calcite.avatica.AvaticaConnection.executeQueryInternal(AvaticaConnection.java:520) at org.apache.calcite.avatica.AvaticaPreparedStatement.executeQuery(AvaticaPreparedStatement.java:133) at com.company.Main.main(Main.java:62) java.lang.RuntimeException: java.sql.SQLException: ERROR 2004 (INT05): Parameter value unbound. Parameter at index 1 is unbound at org.apache.calcite.avatica.jdbc.JdbcMeta.propagate(JdbcMeta.java:683) at org.apache.calcite.avatica.jdbc.JdbcMeta.execute(JdbcMeta.java:880) at org.apache.calcite.avatica.remote.LocalService.apply(LocalService.java:254) at org.apache.calcite.avatica.remote.Service$ExecuteRequest.accept(Service.java:1032) at org.apache.calcite.avatica.remote.Service$ExecuteRequest.accept(Service.java:1002) at org.apache.calcite.avatica.remote.AbstractHandler.apply(AbstractHandler.java:94) at org.apache.calcite.avatica.remote.ProtobufHandler.apply(ProtobufHandler.java:46) at org.apache.calcite.avatica.server.AvaticaProtobufHandler.handle(AvaticaProtobufHandler.java:127) at org.apache.phoenix.shaded.org.eclipse.jetty.server.handler.HandlerList.handle(HandlerList.java:52) at org.apache.phoenix.shaded.org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97) at org.apache.phoenix.shaded.org.eclipse.jetty.server.Server.handle(Server.java:499) at org.apache.phoenix.shaded.org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:311) at org.apache.phoenix.shaded.org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:257) at org.apache.phoenix.shaded.org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java:544) at org.apache.phoenix.shaded.org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:635) at org.apache.phoenix.shaded.org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:555) at java.lang.Thread.run(Thread.java:748) Caused by: java.sql.SQLException: ERROR 2004 (INT05): Parameter value unbound. Parameter at index 1 is unbound at org.apache.phoenix.exception.SQLExceptionCode$Factory$1.newException(SQLExceptionCode.java:483) at org.apache.phoenix.exception.SQLExceptionInfo.buildException(SQLExceptionInfo.java:150) at org.apache.phoenix.jdbc.PhoenixParameterMetaData.getParam(PhoenixParameterMetaData.java:89) at org.apache.phoenix.jdbc.PhoenixParameterMetaData.isSigned(PhoenixParameterMetaData.java:138) at org.apache.calcite.avatica.jdbc.JdbcMeta.parameters(JdbcMeta.java:270) at org.apache.calcite.avatica.jdbc.JdbcMeta.signature(JdbcMeta.java:282) at org.apache.calcite.avatica.jdbc.JdbcMeta.execute(JdbcMeta.java:856) ... 15 more Process finished with exit code 1