|
From: chengbiao z. <chb...@ya...> - 2005-11-12 08:56:19
|
Hi All,
We run the following codes fairly well in spring
1.2.1, but fail in 1.2.4 and 1.2.5.
--code snippet-----------------------
import oracle.sql.BLOB;
try {
String sfzmhm = request.getParameter("sfzmhm");
WebApplicationContext wac =
WebApplicationContextUtils.getRequiredWebApplicationContext(request.getSession().getServletContext());
// Implemantation-II: using JdbcTemplate directly
DataSource ds =
(DataSource)wac.getBean("dataSource");
JdbcTemplate jt = new JdbcTemplate(ds);
// photo is a BLOB field in oracle
BLOB blob = (BLOB)jt.queryForObject(
"select photo from photo_reposit where sfzmhm='" +
sfzmhm + "'",BLOB.class);
// output image-binary into reponse's output stream
...
} catch (Exception ex) {
...
}
-------------------------------------
and it prompts as:
-------------------------------------
2005-11-12 11:11:01,737 ERROR
[com.hzes.web.control.UIShowPhoto]-
org.springframework.dao.TypeMismatchDataAccessException:
Result object for row number 0 and column type 'BLOB'
and value [[B@1875b11] is of type [[B] and could not
be converted to required type [oracle.sql.BLOB]
-------------------------------------
seems like JdbcTemplate.queryForObject returned a
wrong type([B? what's it?).
Any idea? please correct me if I post in wrong list,
TIA.
chengbiao zhou
__________________________________
Start your day with Yahoo! - Make it your home page!
http://www.yahoo.com/r/hs
|