How to store BMP image (which is in base64 string format) into oracle 11g database using spring's jdbctemplate class? -


i want store base64 string (bmp image) oracle 11g database. few links have gone through-

http://forums.asp.net/t/1061466.aspx?how+to+save+image+in+oracle+blob+field+

http://www.dba-oracle.com/t_storing_insert_photo_pictures_tables.htm

but not getting how this? have written code using link -

http://www.technicalkeeda.com/spring-tutorials/insert-image-using-spring-jdbctemplate

my table:

create table  profile_image (img_title varchar2(20) not null, img_data blob,); 

my code db query:

file file = new file("picture.bmp");   if (file.exists())   {      file.delete();   }   outputstream stream;   try (stream = new fileoutputstream(file))   {      stream.write(data);//data byte array converted base64 string    }   catch (ioexception e)   {      e.printstacktrace();   } final string update_user_profile_picture = "update profile_image set img_data = ? img_title = ?";  final object[] replacementobjectlist = new object[]      { new sqllobvalue(stream, (int) file.length(), lobhandler), image_title };  final int count = jdbctemplate.update(update_user_profile_picture, replacementobjectlist, new int[]      { types.blob, types.varchar }); if(count>0) {return success;} else {return failure;} 

but query not updating blob image data , returning failure. help?


Comments

Popular posts from this blog

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

linux - disk space limitation when creating war file -

How to provide Authorization & Authentication using Asp.net, C#? -