title: How do I unit test jdbc code in java?
body: <p>I'd like to write some unit tests for some code that connects to a database, runs one or more queries, and then processes the results.
  (Without actually using a database)</p>
  
  <p>Another developer here wrote our own DataSource, Connection, Statement, PreparedStatement, and ResultSet implementation that will return the corresponding objects based on an xml configuration file. (we could use the bogus datasource and just run tests against the result sets it returns).</p>
  
  <p>Are we reinventing the wheel here? Does something like this exist already for unit testing?
  Are there other / better ways to test jdbc code?</p>