title: insert date in oracle from java using PreparedStatement
body: <p>I am using <em>PreparedStatement</em> for inserting data in Oracle from Java.</p>
  
  <p>Following is my query:</p>
  
  <pre><code>String query ="insert into table_name(ID, Date) values(?,(select to_char(TO_TIMESTAMP_TZ(REPLACE('Wed May 29 09:26:59 IST 2013','IST','Asia/Calcutta'),'Dy Mon DD hh24:mi:ss TZR YYYY'),'Dy Mon DD hh24:mi:ss YYYY') from dual))";
  pstmt = con.prepareStatement(query,ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_UPDATABLE);
  pstmt.setString(1, ID);
  pstmt.setString(2, "Fri Aug 02 12:38:35 IST 2013");
  pstmt.executeUpdate();
  </code></pre>
  
  <p>But I am getting the exception: </p>
  
  <pre><code>java.sql.SQLException: ORA-01858: a non-numeric character was found where a numeric was expected
  </code></pre>
  
  <p>So any suggestion will be appreciated.</p>
  
  <p><strong>Update1</strong></p>
  
  <p>I tried setting <em>Timestamp</em> :</p>
  
  <pre><code>pstmt.setTimestamp(1,Timestamp.valueOf("Fri Aug 02 12:38:35 IST 2013"));
  </code></pre>
  
  <p>But then I am getting exception:</p>
  
  <pre><code>java.lang.IllegalArgumentException: Timestamp format must be yyyy-mm-dd hh:mm:ss[.fffffffff]
  </code></pre>