java - Get image from SQLServer to Android using JDBC -


i trying image sql server , use in android application. code creating table , storing image in database table :

create table imagee (id int not null,img varbinary(max) not null)  insert imagee (id, img)  select 1, bulkcolumn  openrowset( bulk 'c:\razvan\pozedb\hawai.png', single_blob) iamge 

the code trying use, not work , don't errors :

string query = "select * imagee "; statement stmt = con.createstatement(); final resultset rs = stmt.executequery(query);  if (rs.next()) {      final string imagine;     imagine = rs.getstring("img");      byte[] decodestring = base64.decode(imagine, base64.default);     final bitmap decodebitmap = bitmapfactory.decodebytearray(decodestring, 0, decodestring.length);      getactivity().runonuithread(new runnable() {         @override         public void run() {             try{                 //here "img" imageview                 img.setimagebitmap(decodebitmap);             }catch(exception e){                 log.e("eceptie",e.getmessage());             }          }     }); } 

this code surrounded try catch statements , in "doinbackground()" method. connection server made. can id, not image.

please help. thank you!


Comments

Popular posts from this blog

javascript - Create a stacked percentage column -

Optimising Firebase database by automatically overwriting data -

javascript - Angular UI-Grid customTemplate directive causing rows to load slowly/? -