Skip to Main Content

Java Database Connectivity (JDBC)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

JDBC template query--HELP

843859Nov 12 2008 — edited Nov 20 2014
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...
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 10 2008
Added on Nov 12 2008
5 comments
386 views