sandynz commented on issue #3954:
URL: https://github.com/apache/shardingsphere/issues/3954#issuecomment-768370658
>
>
> There still has a issue when I try to create array with connection as
below:
>
> `Connection conn = shardingDataSource.getConnection();`
> `conn.createArrayOf("int8", new Long[]{1L, 2L, 3L});`
>
> A SQLFeatureNotSupportedException will be thrown.
>
> I trace the codes and find such snippets in
SQLFeatureNotSupportedException.java:
>
> ` @Override` public final Array createArrayOf(final String typeName, final
Object[] elements) throws SQLException {
> ` throw new SQLFeatureNotSupportedException("createArrayOf");` }
Hi @hebing0625 , you're right, `conn.createArrayOf` is not supported for
now, and it's not easy to support it.
There is a workaround, use `java.sql.PreparedStatement.setObject`, e.g.
`statement.setObject(1, new long[]{1, 2, 3})`.
The supported primitive array type:
```
long[]
int[]
short[]
byte[]
double[]
float[]
boolean[]
String[]
```
More details refrence PG JDBC driver: `PgPreparedStatement.setObject` and
`PrimitiveArraySupport.isSupportedPrimitiveArray`.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]