title: Is there any way to print a preparedStatement to the console System.out.println
body: <p>I need a way to view the preparedStatement for debugging here is my java code that I wish to print the preparedStatement to the console for.</p>
  
  <pre><code>public class UnitTestDMUtility_Select {
  
  
  @Test
  public void testQUERY_CHECKBOTHPARTS() throws Exception{
  
      UnitTestHelper helper = new UnitTestHelper();
      Connection con = helper.getConnection(helper.sourceDBUrl);
      Connection conTarget = helper.getConnection(helper.targetDBUrl);
  
  
      PreparedStatement stmt = con.prepareStatement(DMUtility.QUERY_CHECKBOTHPARTS);
      stmt.setInt(1, 101);
      ResultSet sourceVal = stmt.executeQuery();
      //Here is the QUERY
      //select count(*) from tr_demand where demandtypeid=101
      stmt = conTarget.prepareStatement(DMUtility.QUERY_CHECKBOTHPARTS);
      stmt.setInt(1, 101);
      ResultSet targetVal = stmt.executeQuery();
  
      assertTrue(helper.resultSetsEqual2(sourceVal,targetVal));
  
  }
  
  } 
  </code></pre>