ReyYang commented on pull request #14767:
URL: https://github.com/apache/shardingsphere/pull/14767#issuecomment-1012907871
During debugging, it was found that the Java Type returned by PgResultSet is
java.lang.Double, and the type needed to insert into PostgreSQL is
java.math.BigDecimal
- test case
```groovy
import java.sql.Connection
import java.sql.Driver
import java.sql.PreparedStatement
Class clazz = Class.forName("org.postgresql.Driver");
Driver driver = clazz.newInstance() as Driver;
String url = "jdbc:postgresql://127.0.0.1:5432/demo_ds_0";
Properties info = new Properties();
info.setProperty("user", "postgres");
info.setProperty("password", "123456");
Connection conn = driver.connect(url, info);
PreparedStatement ps = conn.prepareStatement("insert into table_mix_test
(id, shard_id, t_money) values (?, ?, ?);")
ps.setObject(1, 1);
ps.setObject(2, 1);
ps.setObject(4, new BigDecimal(100.4));
def execute = ps.execute()
println execute
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]