JDBCTemplate not fetching records more than 1500
I am using JDBCTemplate for fetching the records...my table have 46,000 rows that I want to wrap in a user type object using rowmapper.
But when I try below code it shows " Executing SQL query [Select USER_ID,Desc from Q7.USERBSC_INFO where STAT_CD='ACTIVE']" and after that nothing happened..I waited for 15 minutes but still showed nothing..but application still working...no exception
I am using JCC drivers of DB2, this is a mainframe DB2
But when I run the query for only 1500 records it work fine...is there any limitation for fetching records?
When I run the same query inside AQT client, it works fine...
public List<usr> getusr() {
List<usr> list = new ArrayList<usr>();
String query = "Select USER_ID,Desc from Q7.USERBSC_INFO where STAT_CD='ACTIVE'";
list = getJdbcTemplate().query(query, DB2RowMapper.mUsrInfo);
return list;
}
RowMapper
public static RowMappe开发者_JAVA技巧r mUsrInfo = new RowMapper()
{
public Object mapRow(ResultSet rs, int rowNum) throws SQLException
{
Usr usr=new Usr();
usr.setUsrId(rs.getString("USER_ID"));
usr.setDesc(rs.getString("DESC"));
return usr;
}
};
You can limit the no of records in spring Jdbc Template(using a maxRows options) but in don't think that's the case here. I guess the no of records()46000 that are being fetched is the reason for this delay...
You can either try optimizing your query or else try using this clause at the end may be it might help
OPTIMIZE FOR n ROWS
精彩评论