In this section , we will insert a image into a table. For inserting image, table's field (in which image will be stored) must be define as "blob".
First, Create table'inImage' in "mysql" as--
|create table inimage(id int(5)NOT NULL auto_increment,name
city varchar(30),image blob,PRIMARY KEY(id))
For inserting whole image, we have to create an 'InputStream' object from this file. And through this object and "setBinaryStream() ", we pass the binary file content to the BLOB column .
Syntax of "setBinaryStream() " --
setBinaryStream(int parameterIndex, InputStream x, int length) --->The data will be read from the InputStream as needed for "length" bytes.
Recommend the tutorial