title: How to convert Java String to Teradata DATE and Timestamp
body: <p>My java code generates two <code>Strings</code>:</p>
  
  <pre><code>String myDate = "10/10/2013";
  String myTimestamp = "2013-10-09 14:30:20"; 
  </code></pre>
  
  <hr>
  
  <p>I need to feed these values to a <code>prepared statement</code>, so that I could upload them using <code>jdbc</code> to  <code>Teradata</code> </p>
  
  <p>Here is what I tried : </p>
  
  <pre><code>String in = " INSERT INTO " + myTab + " VALUES (?,?) "; 
  
  PreparedStatement prst = null; 
  prst = connection.prepareStatement(in); 
  
     // add date
     prst.setDate(1, (Date) new SimpleDateFormat("MM/dd/yyyy").parse(myDate));
  
     //add timestamp
     prst.setDate(2, (Date) new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(myTimestamp)); 
  </code></pre>
  
  <p>The above code compiles but does not work. I get an <code>empty string</code> error . How can I convert a <code>String</code> into <code>Teradata types DATE, TIMESTAMP</code> in order to add them to the prepared statement ? </p>