title: sql update statement does not execute properly
body: <p>I'm having problem with an update query. following is the function I'm calling:</p>
  
  <pre><code>    public static void update(ArrayList&lt;String&gt; arr, int id)
      {   
          Connection conn = null;
          System.out.println(lineArr.size());
          try
          {
  
          Class.forName ("com.mysql.jdbc.Driver").newInstance();
          conn = DriverManager.getConnection (url,userName,password);
  
          for(int i=0;i&lt;arr.size();i++)
          {
          String currentLine = arr.get(i);
          //process the string
          int lastSlash=currentLine.lastIndexOf("\\"); 
          String location=currentLine.substring(0, lastSlash+1);
              location=location.replace("\\", "\\\\");
          String name=currentLine.substring(lastSlash+1);         
  
          String query=" UPDATE tbl1 " +
                   " set tbl1.id= ?"+
                   " where tbl1.sid =(select tbl2.sid from tbl2 " +
                         "where tbl2.cl=? and tbl2.cl2=?)";
              PreparedStatement psmt = conn.prepareStatement(query);
                      psmt.setString(1, id+"");
              psmt.setString(2, location);
              psmt.setString(3, name);
                      System.out.println(psmt1.toString());
              psmt.executeUpdate();
              System.out.println("-----------------------------------------------");
          }//for
          //conn.close();
      }
      catch (Exception e)
      {
          System.out.println(e.getMessage());
          e.printStackTrace();
      }
  }
  </code></pre>
  
  <p>Following are the print outs:</p>
  
  <pre><code>2
  
      com.mysql.jdbc.JDBC4PreparedStatement@ffcd87:  UPDATE tb1  set tbl1.id= '391' WHERE tbl1.sid =(select tbl2.id from tbl2 where tbl2.location='src\\ps\\' and tbl2 .name='test.cxx')
      -----------------------------------------------
      **com.mysql.jdbc.JDBC4PreparedStatement@e7e7b:   UPDATE tb1  set tbl1.id= '391' WHERE tbl1.sid =(select tbl2.id from tbl2 where tbl2.location='\nsrc\\ps\\' and tbl2 .name='test.hxx')**
  </code></pre>
  
  <p>Notice that how the prepared statement added <code>\n</code> at the beginning of the location</p>