diff --git a/src/main/java/net/snowflake/client/jdbc/SnowflakeConnectionV1.java b/src/main/java/net/snowflake/client/jdbc/SnowflakeConnectionV1.java index 23ce7d2ef..e93a38d08 100644 --- a/src/main/java/net/snowflake/client/jdbc/SnowflakeConnectionV1.java +++ b/src/main/java/net/snowflake/client/jdbc/SnowflakeConnectionV1.java @@ -726,7 +726,7 @@ public String getClientInfo(String name) throws SQLException { @Override public Array createArrayOf(String typeName, Object[] elements) throws SQLException { logger.trace("Array createArrayOf(String typeName, Object[] " + "elements)", false); - return new SfSqlArray(JDBCType.valueOf(typeName).getVendorTypeNumber(), elements); + return new SfSqlArray(JDBCType.valueOf(typeName.toUpperCase()).getVendorTypeNumber(), elements); } @Override diff --git a/src/test/java/net/snowflake/client/jdbc/BindingAndInsertingStructuredTypesLatestIT.java b/src/test/java/net/snowflake/client/jdbc/BindingAndInsertingStructuredTypesLatestIT.java index 55cdf9996..78b55e756 100644 --- a/src/test/java/net/snowflake/client/jdbc/BindingAndInsertingStructuredTypesLatestIT.java +++ b/src/test/java/net/snowflake/client/jdbc/BindingAndInsertingStructuredTypesLatestIT.java @@ -272,8 +272,11 @@ public void testWriteArray(ResultSetFormatType queryResultFormat) throws SQLExce statement.execute(" CREATE OR REPLACE TABLE array_of_integers(arrayInt ARRAY(INTEGER))"); Array array = connection.createArrayOf("INTEGER", new Integer[] {1, 2, 3}); + Array arrayFromLowerCaseType = connection.createArrayOf("integer", new Integer[] {1, 2, 3}); stmt.setArray(1, array); stmt.executeUpdate(); + stmt.setArray(1, arrayFromLowerCaseType); + stmt.executeUpdate(); try (ResultSet resultSet = statement.executeQuery("SELECT * from array_of_integers"); ) { resultSet.next(); @@ -282,6 +285,10 @@ public void testWriteArray(ResultSetFormatType queryResultFormat) throws SQLExce assertEquals(Long.valueOf(1), resultArray[0]); assertEquals(Long.valueOf(2), resultArray[1]); assertEquals(Long.valueOf(3), resultArray[2]); + + resultSet.next(); + Long[] resultArrayFromLowerCaseType = (Long[]) resultSet.getArray(1).getArray(); + assertArrayEquals(resultArray, resultArrayFromLowerCaseType); } } }