title: Need JDBC solution for MySQL Incorrect datetime value error
body: <p>While trying to insert a record into a certain table, I'm getting an error as follows:</p>
  
  <blockquote>
    <p>Data truncation: Incorrect datetime value: '0000-00-00 00:00:00' for column 'deleted_at' at row 1</p>
  </blockquote>
  
  <p>Searching around I found the following questions to be quite insightful:</p>
  
  <ul>
  <li><a href="https://stackoverflow.com/q/35565128/3681282">MySQL Incorrect datetime value: '0000-00-00 00:00:00'</a></li>
  <li><a href="https://stackoverflow.com/q/20088808/3681282">Data truncation: Incorrect datetime value: ''</a></li>
  <li><a href="https://stackoverflow.com/q/7564365/3681282">MySQL: Data truncation: Incorrect datetime value: '2006-10-01 02:22:44'</a></li>
  </ul>
  
  <p>But I can't take any of the solutions given in these answers because of the following reasons:</p>
  
  <ul>
  <li>Using any other JAR as mentioned <a href="https://stackoverflow.com/a/25902537/3681282">here</a> and <a href="https://stackoverflow.com/a/28288202/3681282">here</a> (although this isn't a maven project) isn't an option. I have to use the same jar.</li>
  <li>I can't use anything other than '0000-00-00 00:00:00' for the field <code>deleted_at</code>. Apparently, there is a buttload of checking against this. You see, initially, delete_at date can't be set (I would have used a flag like <code>is_deleted</code>. If there is a better way please tell me).</li>
  <li>And changing MySQL configuration isn't an option like mentioned <a href="https://stackoverflow.com/a/35565866/3681282">here</a>. He did a nice job of explaining it. I believe this is the main issue.</li>
  </ul>
  
  <blockquote>
    <p>As to why you are encountering the issue, it's likely that the sql_mode setting for your session includes <code>NO_ZERO_DATES</code>.</p>
  </blockquote>
  
  <p>I (sadly) don't have much control over these things as I'm not the only one working on this project. To give you an insight about the project, this is how I'm getting the error.</p>
  
  <p><a href="https://i.stack.imgur.com/oc9zo.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/oc9zo.png" alt="enter image description here"></a></p>
  
  <p>They don't use any logging. Hope you get the picture.</p>
  
  <p>So, given the constraints I'm bound with, is there a way to insert '0000-00-00 00:00:00' other than the solutions given above (I'm hoping maybe using something in JDBC).</p>
  
  <p>MySQL Server Version: <strong>5.7.12-0ubuntu1</strong></p>