title: How can I store an image in my SQL database?
body: <p>in my app I have set an image from the gallery in an image view. Now I want to store that image in my SQL database. </p>
  
  <ol>
  <li>What do I have to change in my SQL database? (BLOB??)</li>
  <li>What is the best way to retrieve the image from the image view and store it in the SQL Database?</li>
  </ol>
  
  <p>Here is my SQL Database:</p>
  
  <pre><code>private static final String DATABASE_CREATE =
          "create table " + DATABASE_TABLE + " ("
                  + KEY_ROWID + " integer primary key autoincrement, "
                  + KEY_TITLE + " text not null, " 
                  + KEY_BODY + " text not null, " 
                  + KEY_DATE_TIME + " text not null);"; 
  </code></pre>
  
  <p>Here I get the path of the image in the gallery and then set the image in the image view</p>
  
  <pre><code>public void onActivityResult(int requestCode, int resultCode, Intent data) {
      if (resultCode == RESULT_OK) {
          if (requestCode == PICK_FROM_FILE) {
              Uri selectedImageUri = data.getData();
              selectedImagePath = getPath(selectedImageUri);
  
              Log.v("IMAGE PATH====&gt;&gt;&gt;&gt; ",selectedImagePath);
  
           // Decode, scale and set the image.
              Bitmap myBitmap = BitmapFactory.decodeFile(selectedImagePath);
              Bitmap scaledBitmap = Bitmap.createScaledBitmap(myBitmap, NEW_WIDTH, NEW_HEIGHT, true);
              myBitmap.recycle();
              myBitmap = null;
  
              mImageView.setImageBitmap(scaledBitmap);
  
          }
      }
  }
  </code></pre>