File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JDBC and Relational Databases and the fly likes Small SQL databases for JUNIT tests Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "Small SQL databases for JUNIT tests" Watch "Small SQL databases for JUNIT tests" New topic

Small SQL databases for JUNIT tests

Sajid Insaf

Joined: Nov 26, 2002
Posts: 5
I have some JDBC code for SQL databases and have written JUNIT tests for it. The tests are run through ant.
The requirement is to have a small database that can form part of the test suite and be stored in the version control software's database so that when deployed the tests can be run automatically without having to access an external database.
I have explored the option of using mock objects and require a real database so that protocol/driver issues can be tested.
Does anyone know of a free database that can be used for this?
Tina Coleman
Ranch Hand

Joined: Dec 12, 2001
Posts: 150
To test your driver, wouldn't you need a database that uses the same driver as whatever it is you're using as your application's database? There are several free databases out there, but I think your driver concern would be the big factor in determining which to use. Go out to Sun's site and look up your JDBC driver to see what other databases it may support - then use one of those. JDBC Drivers
Sajid Insaf

Joined: Nov 26, 2002
Posts: 5
Thanks for the reply and sorry about using confusing language while specfying my requirement. I have not developed a driver. I have just written some java code that uses standard SQL statements to query databases that support SQL. So I need to test this piece of code using such a database.
I have found the HSQL database from which I think should serve the purpose.
Thanks again.
I agree. Here's the link:
subject: Small SQL databases for JUNIT tests
It's not a secret anymore!