-1

I am developing a very large scale J2EE application and we chose to use Derby as an embedded database for junit testing since hitting the actual prod database will slow down our tests. When I bootstrap my application, the Derby DB will create all the tables so I can run JDBC queries against it. It works fine but the drawback is I cannot actually query any of the tables except through JDBC calls at runtime, so if I need to make changes to my queries, I need to stop the app, modiify my query statements, then restart the application and run in debug. This process makes it very difficult when it comes to analyzing complex queries. Does anyone know of some kind of Derby plugin that can help me to query the DB without doing it through my java code?

Jason
  • 1,371
  • 4
  • 21
  • 44
  • Is the problem that you cannot access the database while your application is running, because you get "another application is accessing this database"? If so, you could use what's known as the "embedded server". – Bryan Pendleton May 08 '15 at 20:55

1 Answers1

0

If you are using Maven for your build, you can use the derby-maven-plugin, which I wrote and is available on GitHub and via Maven Central. It will take care of starting and stopping the database for you before your tests. You will need to populate this database, yourself of course. You will also have the database in your target/derby folder after the tests execute, so you can always query the data yourself afterwards. This will help you work in a separate development environment which doesn't affect the production database.

You can check here for my answer to a similar question.

Community
  • 1
  • 1
carlspring
  • 31,231
  • 29
  • 115
  • 197