Welcome to the Cloudera Community

Announcements
Celebrating as our community reaches 100,000 members! Thank you!

Who agreed with this topic

Impala JDBC fails to map a string while using setObject method of PreparedStatement

avatar
Explorer

Hi,

 

 

 

PreparedStatement ps = connection.prepareStatement("select description from sample_07 where code in (?)");
ps.setObject(1, "00-0000");
ResultSet rs = ps.executeQuery();

When I tried mapping a string to PreparedStatement parameter, it throws the following exception

Exception in thread "main" java.sql.SQLException: [Simba][ImpalaJDBCDriver](500352) Error getting the parameter data type: HIVE_PARAMETER_QUERY_DATA_TYPE_ERR_NON_SUPPORT_DATA_TYPE
at com.cloudera.hivecommon.core.CoreUtils.getParameterType(Unknown Source)
at com.cloudera.hivecommon.core.CoreUtils.buildParameterQuery(Unknown Source)
at com.cloudera.hivecommon.dataengine.HiveJDBCNativeQueryExecutor.execute(Unknown Source)
at com.cloudera.jdbc.common.SPreparedStatement.executeWithParams(Unknown Source)
at com.cloudera.jdbc.common.SPreparedStatement.executeQuery(Unknown Source)
Caused by: com.cloudera.support.exceptions.GeneralException: [Simba][ImpalaJDBCDriver](500352) Error getting the parameter data type: HIVE_PARAMETER_QUERY_DATA_TYPE_ERR_NON_SUPPORT_DATA_TYPE
... 5 more
Caused by: com.cloudera.support.exceptions.GeneralException: HIVE_PARAMETER_QUERY_DATA_TYPE_ERR_NON_SUPPORT_DATA_TYPE
... 5 more

The exception is not thrown if I try to map an integer using setObject method

 

PreparedStatement ps = connection.prepareStatement("select description from sample_07 where salary > (?)");
ps.setObject(1, 20000);
ResultSet rs = ps.executeQuery();

The JDBC drivers for other databases works fine in both the cases. 

 

Is it known issue?

 

PS: Above works if provide the type of the parameter. In actual use case, I do not have an option to know the datatype beforehand. The queries are generated during runtime. 

 

/Saravana

 

Who agreed with this topic