Using Sharding-Proxy to insert orrcurs error when using JDBC PreparedStatement in backend database PostgreSQL
Bug Report
For English only, other languages will not accept.
Before report a bug, make sure you have:
- Searched open and closed GitHub issues.
- Read documentation: ShardingSphere Doc.
Please pay attention on issues you submitted, because we maybe need more details. If no response more than 7 days and we cannot reproduce it on current information, we will close it.
Please answer these questions before submitting your issue. Thanks!
Which version of ShardingSphere did you use?
4.0.0-rc3
Which project did you use? Sharding-JDBC or Sharding-Proxy?
Sharding-Proxy
Expected behavior
Successfully inserted a record
Actual behavior
No this record in table
Reason analyze (If you can)
Steps to reproduce the behavior, such as: SQL to execute, sharding rule configuration, when exception occur etc.
- use database: postgresql
- sql to execute: INSERT INTO t_encrypt(pwd,content) VALUES(?,?)
- Statement: PreparedStatement
config:

exception:

Example codes for reproduce this issue (such as a github link).
DataSource source = DataSourceFactory.newRawJDBCDataSource()
.dbType(DatabaseType.POSTGRESQL)
.dataSourceName("MyEncrypt")
.host("localhost")
.port(3307)
.userName("root")
.password("root")
.create();
Connection connection = source.getConnection();
PreparedStatement statement = connection.prepareStatement("INSERT INTO t_encrypt(pwd,content) VALUES(?,?)");
statement.setString(1,"password");
statement.setString(2,"this is encrypt test");
statement.executeUpdate();
I will try to reproduce this exception first.
Thank you, I just assign to you.
Hi, here are current test results:
- use postgres 12.0 and the latest sharding-proxy, statement and prepared statement both can insert successful.
(but the Response client got has some problem, we may discuss in another issue. ) - use postgres 12.0 and the proxy compiled from commit version 'ae2ede4bf01bb2cae6a89ae74d506c7fe338ea39' , ArrayIndexOutOfBoundsException occured.
@haetao can you try the latest sharding-proxy
Ok, I 'll try the latest Proxy later. Thank you!
Another error occured!!! @RaigorJiang
This error is the same as the one you sent to the mailing list.
org.postgresql.util.PSQLException:
at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2440)
at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2183)
at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:308)
at org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.java:441)
at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:365)
at org.postgresql.jdbc.PgPreparedStatement.executeWithFlags(PgPreparedStatement.java:143)
at org.postgresql.jdbc.PgPreparedStatement.executeUpdate(PgPreparedStatement.java:120)
at com.zaxxer.hikari.pool.ProxyPreparedStatement.executeUpdate(ProxyPreparedStatement.java:61)
Yes, it's a different error, let's open a new issue.
Hi, @haetao , new issue is #3555.
can this issue be closed?
Yes! #3419 can be closed!