title: Batch insert using groovy Sql?
body: <p>How can you do a batch insert using groovy Sql while simulating prepared statements? All the examples I've found are similar to the following and don't use prepared statements.</p>
  <pre><code>withBatch  { stmt -&gt;
  stmt.addBatch(&quot;insert into table (field1,field2) values('value1','value2')&quot;)
  stmt.addBatch(&quot;insert into table (field1,field2) values('value3','value4')&quot;)
  }
  </code></pre>
  <p>According to this link <a href="https://issues.apache.org/jira/browse/GROOVY-3504" rel="nofollow noreferrer">https://issues.apache.org/jira/browse/GROOVY-3504</a> there is no way to use prepared statements directly from within batch. What is the best way to simulate this so I can avoid having to write my own code to avoid sql injection?</p>