Please pay attention on issues you submitted, because we maybe need more details.
If no response anymore and we cannot reproduce it on current information, we will close it.
Please answer these questions before submitting your issue. Thanks!
Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?
ShardingSphere-Proxy
Expected behavior
Insert multi records by one jdbc connection can be success.
Actual behavior
Failed to insert multi records by one jdbc connection. only four recors are successfully inserted.
Reason analyze (If you can)
Steps to reproduce the behavior, such as: SQL to execute, sharding rule configuration, when exception occur etc.
create table
drop table t_order;
create table t_order (
id bigint,
c_int integer,
c_smallint smallint,
c_float real,
c_double double precision,
c_numeric numeric(10,2),
c_boolean boolean,
c_char character(32),
c_text text,
c_bytea bytea,
c_date date,
c_time time without time zone,
c_smalldatetime smalldatetime,
c_timestamp timestamp without time zone,
c_timestamptz timestamp with time zone,
c_interval interval,
c_array integer[],
c_json json,
c_jsonb jsonb,
c_uuid uuid,
c_hash32 hash32,
c_tsvector tsvector,
c_bit bit(4),
c_int4range int4range,
c_reltime reltime,
c_abstime abstime,
c_point point,
c_lseg lseg,
c_box box,
c_circle circle,
c_bitvarying bit varying(32),
c_cidr cidr,
c_inet inet,
c_macaddr macaddr,
c_hll hll(14,10,12,0),
PRIMARY KEY ( id )
);
run java script
[peilq_ss@openGauss52 hw-cdc-demo]$ java -cp "resources:target:lib/*" DataInit
Nov 07, 2023 7:37:31 PM org.opengauss.core.v3.ConnectionFactoryImpl openConnectionImpl
INFO: [4d323926-8bca-4977-aaf2-cb19b8a0f0e2] Try to connect. IP: 20.20.20.52:13000
Nov 07, 2023 7:37:31 PM org.opengauss.core.v3.ConnectionFactoryImpl openConnectionImpl
INFO: [20.20.20.52:39458/20.20.20.52:13000] Connection is established. ID: 4d323926-8bca-4977-aaf2-cb19b8a0f0e2
Nov 07, 2023 7:37:31 PM org.opengauss.core.v3.ConnectionFactoryImpl openConnectionImpl
INFO: Connect complete. ID: 4d323926-8bca-4977-aaf2-cb19b8a0f0e2
Exception in thread "main" org.opengauss.util.PSQLException: [20.20.20.52:39458/20.20.20.52:13000] ERROR: Unknown exception: Can not find JDBC type `2003` in PostgreSQL column type
at org.opengauss.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2922)
at org.opengauss.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2643)
at org.opengauss.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:375)
at org.opengauss.jdbc.PgStatement.runQueryExecutor(PgStatement.java:561)
at org.opengauss.jdbc.PgStatement.executeInternal(PgStatement.java:538)
at org.opengauss.jdbc.PgStatement.execute(PgStatement.java:396)
at org.opengauss.jdbc.PgPreparedStatement.executeWithFlags(PgPreparedStatement.java:166)
at org.opengauss.jdbc.PgPreparedStatement.executeUpdate(PgPreparedStatement.java:136)
at DataInit.main(DataInit.java:80)
Example codes for reproduce this issue (such as a github link).
DataInit.java
import org.apache.commons.codec.digest.DigestUtils;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.util.Random;
import java.util.UUID;
public final class DataInit {
public static void main(final String[] args) throws SQLException {
String sql =
"INSERT INTO t_order (id,c_int,c_smallint,c_float,c_double,c_numeric,c_boolean,c_char,c_text,c_bytea,c_date,c_time,c_smalldatetime,c_timestamp,c_timestamptz,c_interval,c_array,c_json,c_jsonb,c_uuid,c_hash32,c_tsvector,c_bit,c_int4range,c_reltime,c_abstime,c_point,c_lseg,c_box,c_circle,c_bitvarying,c_cidr,c_inet,c_macaddr,c_hll\n"
+ ")\n"
+ "VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?\n"
+ ")";
Random random = new Random();
// Connection connection = DriverManager.getConnection("jdbc:opengauss://20.20.20.54:17000/test?stringtype=unspecified&bitToString=true&batchMode=on", "test", "Huawei@123");
Connection connection = DriverManager.getConnection("jdbc:opengauss://20.20.20.52:13000/sharding_db?stringtype=unspecified&bitToString=true&batchMode=on", "root", "root");
PreparedStatement preparedStatement = connection.prepareStatement(sql);
for (int i = 0; i <= 119; i++) {
preparedStatement.setLong(1, i);
preparedStatement.setInt(2, random.nextInt());
preparedStatement.setShort(3, (short) random.nextInt());
preparedStatement.setString(4, i + ".1234");
preparedStatement.setString(5, i + ".123456");
preparedStatement.setString(6, i + ".99");
preparedStatement.setBoolean(7, i % 2 == 0);
preparedStatement.setString(8, i + "char");
preparedStatement.setString(9, i + "text");
preparedStatement.setObject(10, new byte[]{0, 1});
preparedStatement.setObject(11, LocalDate.now());
preparedStatement.setObject(12, LocalTime.now());
preparedStatement.setObject(13, "2000-01-01");
LocalDateTime now = LocalDateTime.now();
preparedStatement.setObject(14, now);
preparedStatement.setObject(15, now);
preparedStatement.setString(16, "0 years 0 mons 1 days 2 hours 3 mins 4 secs");
preparedStatement.setObject(17, "{1, 2, 3}");
preparedStatement.setObject(18, String.format("{\"test\":\"%s\"}", i));
preparedStatement.setObject(19, String.format("{\"test\":\"%s\"}", i));
preparedStatement.setObject(20, UUID.randomUUID().toString());
preparedStatement.setObject(21, DigestUtils.md5Hex(String.valueOf(i)));
preparedStatement.setObject(22, null);
preparedStatement.setObject(23, "0000");
preparedStatement.setObject(24, "[1,1000)");
preparedStatement.setObject(25, "1 years 1 mons 10 days");
preparedStatement.setObject(26, "2000-01-02 00:00:00+00");
preparedStatement.setObject(27, "(1.0,1.0)");
preparedStatement.setObject(28, "[(0.0,0.0),(2.0,2.0)]");
preparedStatement.setObject(29, "(3.0,3.0),(1.0,1.0)");
preparedStatement.setObject(30, "<(5.0,5.0),5.0>");
preparedStatement.setObject(31, null);
preparedStatement.setObject(32, "192.168.0.0/16");
preparedStatement.setObject(33, "192.168.1.1");
preparedStatement.setObject(34, "08:00:2b:01:02:03");
preparedStatement.setObject(35, "\\x484c4c00000000002b05000000000000000000000000000000000000");
preparedStatement.executeUpdate();
// preparedStatement.addBatch();
}
// preparedStatement.executeBatch();
preparedStatement.close();
connection.close();
}
}
Bug Report
For English only, other languages will not accept.
Before report a bug, make sure you have:
Please pay attention on issues you submitted, because we maybe need more details. If no response anymore 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?
Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?
ShardingSphere-Proxy
Expected behavior
Insert multi records by one jdbc connection can be success.
Actual behavior
Failed to insert multi records by one jdbc connection. only four recors are successfully inserted.
Reason analyze (If you can)
Steps to reproduce the behavior, such as: SQL to execute, sharding rule configuration, when exception occur etc.
Example codes for reproduce this issue (such as a github link).
DataInit.java