This content has been marked as final.
Show 2 replies
-
1. Re: problem with a4j:mediaOutput
nbelaevski Dec 6, 2008 12:56 PM (in response to orkun)Don't you have to import javax.sql.DataSource?
-
hello
I am trying to retrieve an image from database and display with "a4j:mediaOutput"
here is the core of the code:
Statement stmt = conn.createStatement();
ResultSet rst = stmt.executeQuery("select * from fruit"); while(rst.next()) {
byte[] imgBytes=new byte[(int) rst.getBytes(2).length];
for (int i = 0; i < imgBytes.length - 1; i++) {
imgBytes = rst.getByte(2);
}
output.write(imgBytes);
}
I get this exception :
java.lang.ClassCastException: org.apache.tomcat.dbcp.dbcp.BasicDataSource cannot be cast to javax.activation.DataSource
how may the solution be ?
regards
Don't you have to import javax.sql.DataSource?