Hi,
I am getting Uncategorized SQL exception for my code:
The error is:
org.springframework.jdbc.UncategorizedSQLException: PreparedStatementCallback; uncategorized SQLException for SQL [select distinct table_desc from TABLE order by table_desc where month = ? and year = ? ]; SQL state [HY000]; error code [857]; [NCR][Teradata JDBC Driver]:PreparedStatement.setObject: Unsupported Object java.util.Hashtable ; nested exception is java.sql.SQLException: [NCR][Teradata JDBC Driver]:*PreparedStatement.setObject: Unsupported Object java.util.Hashtable*
Here is the code
public class ABC {
private static final String MYDATE = " month = ? and year = ? ";
public List<String> getTables(Report report) {
List<String> tables = new ArrayList<String>();
JdbcTemplate template = new JdbcTemplate( dataSource );
Object sqlParameters[] = null;
sqlParameters = new Object[]{ getMonthAndYear( report ) };
String sql = "select distinct table_description from TABLE " +
" order by table_description where ";
tables= template.queryForList(sql + MYDATE,sqlParameters); //the error is throwing on this line
return( tables);
}
private Map<Integer, Integer> getMonthAndYear( Report report ) {
Calendar today = Calendar.getInstance();
Map<Integer, Integer> monthYear = new Hashtable<Integer, Integer>();
monthYear.put( Calendar.MONTH, today.get( Calendar.MONTH ) );
monthYear.put( Calendar.YEAR, today.get( Calendar.YEAR ) );
System.out.println("monthYear :"+monthYear);//this prints monthYear :{2=10, 1=2008}
return( monthYear );
}
}
Can anybody help me solve it? It's something to do with the parameters I am getting back...(my paramater is a map)
I will appreciate your help,
Thanks in advance...