I usually made a very simple java-wrapper that tests this code using a localhost connection with some standard user / password settings.
Remember to use a temporary database or a well-known test database so that your tests are not ruined by anything important.
The reason above is because I had a need for specific databases (non-standard functions, etc.).
If you want to test the standard sql material for junit tests (e.g. syntax, selects, etc.), I would like to use the built-in sql database in java (only for service memory). Thus, it is easy to check many things without having to install db and also without the risk of destroying other installations.
source share