Reply
Highlighted
New Contributor
Posts: 5
Registered: ‎10-22-2015

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

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