title: Different images inserted from Android into database shows same value?
body: <p>I am trying to insert image into SQL Server here is my code and it works perfectly (it inserts image into database). My problem starts after insertion and  when I see the image column in database.</p>
  <pre><code>protected String doInBackground(String... strings) {
      try {
          con = connectionClass(ConnectionClass.un, ConnectionClass.pass, ConnectionClass.db, ConnectionClass.ip);
          if (con == null) {
              z = &quot;No Internet Connection&quot;;
          } else {
  
              String sql = &quot;INSERT INTO [dbo].[tblComplaint] (customerName,type,image) VALUES ('&quot; + name.getText() + &quot;','&quot; + complain.getText() + &quot;','&quot; +encodedImage+&quot;')&quot;;
              //PreparedStatement stmt = con.prepareStatement(sql);
              //stmt.executeUpdate();
              Statement stmt = con.createStatement();
              stmt.executeUpdate(sql);
          }
      } catch (Exception e) {
          isSuccess = false;
          z = e.getMessage();
      }
  
      return z;
  }
  
  @SuppressLint(&quot;NewApi&quot;)
  public Connection connectionClass(String user, String password, String database, String server) {
      StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build();
      StrictMode.setThreadPolicy(policy);
      Connection connection = null;
      String connectionURL = null;
      try {
          Class.forName(&quot;net.sourceforge.jtds.jdbc.Driver&quot;);
          connectionURL = &quot;jdbc:jtds:sqlserver://&quot; + server + &quot;/&quot; + database + &quot;;user=&quot; + user + &quot;;password=&quot; + password + &quot;;&quot;;
          connection = DriverManager.getConnection(connectionURL);
      } catch (Exception e) {
          Log.e(&quot;SQL Connection Error : &quot;, e.getMessage());
      }
  
      return connection;
  }
  </code></pre>
  <p>Problem: No matter what image I sent into database, it only inserts the same set of strings starting with: <code>0x2F396A2F34414151536B5A4A5267414241514141415141424141442F3467496F53554E44583142</code> and it goes on for a 100s lines, which I am guessing is not right. I have tried send 4-5 different images but this does not change. What am I doing wrong? Data type for image column is <code>image</code>, I have also tried <code>varbinary(max)</code> and so on.</p>