You can store images in the database in java by the help of PreparedStatement interface. The setBinaryStream() method of PreparedStatement is used to set Binary information into the parameterIndex.
For storing image into the database, BLOB (Binary Large Object) datatype is used in the table. For example:
Let's write the jdbc code to store the image in the database. Here we are using d:\\d.jpg for the location of image. You can change it according to the image location.
If you see the table, record is stored in the database but image will not be shown. To do so, you need to retrieve the image from the database which we are covering in the next page.
A11 Acharya Niketan
Mayur Vihar 1
Near MayurVihar Metro Station