This week's giveaway is in the EJB and other Java EE Technologies forum. We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line! See this thread for details.
Hello All, I am developing a simple web application. One of my tables contains photographs/images/pictures. can anybody pls tell me abt how to read them from table also, how to write them also.I am using access / mysql database with tomcat 5 thanx in advance with regards devayni
Sometimes people just store the path to the picture in the database.
If you want to store the picture itself, you can use column type BLOB. How you work with BLOB can depend on your DBMS and any support you're getting from frameworks you may be using (Hibernate makes it easy). With raw JDBC, you can insert a row using a PreparedStatement and its setBinaryStream method (or setBytes, but I haven't tried that). In the other direction, to get the data out of a ResultSet, you can use getBinaryStream (or getBytes, but I haven't tried that either), or getBlob and Blob methods.