2

I am using the embedded derby database in a small Java project. Are there any possible ways to visualize the database? I hope to see the tables and data in the database.

I have tried DbVisualizer. Since embedded derby database could only accessed by one application, I am not sure how to use DbVisualizer to view the data.

Angie.W
  • 21
  • 1
  • 1
    You need to start Derby in server mode –  May 16 '17 at 05:41
  • Are you using an IDE? I use NetBeans, and I can view my Derby databases via the Services browser. – Matt May 16 '17 at 05:46
  • It looks like DbVisualizer can only visualise graphs/charts in the Pro edition, observed [here](http://stackoverflow.com/questions/44000556/db-vis-how-to-visualise-the-data-in-data-monitor-with-graphs). The free edition is able to show the schema diagram/reference diagram about how primary/secondary keys connected. – hhh May 16 '17 at 11:58
  • @matt, I am now using IntelliJ IDEA. I used NetBeans before, however, I could only view server mode Derby databases at that time. Are you able to view embedded Derby databases in NetBeans? – Angie.W May 17 '17 at 00:45
  • @a_horse_with_no_name, Thanks for the answer and I agree with that. However, I am confused that there are two options in DbVis - Derby server & Derby embedded. It doesn't make sense if it doesn't support embedded Derby databases... – Angie.W May 17 '17 at 00:51
  • You can make a connection to your embedded database in NetBeans. I have a project with an embedded database, I can connect to it by specifying the file path i.e. `jdbc:derby:/path/to/project/src/test/resources/database-name`and user credentials in NetBeans > Services > Databases and then view the schema and execute SQL against it. – Matt May 17 '17 at 01:07
  • You can use Derby embedded in DbVis if DbVis is the one process starting the database. –  May 17 '17 at 04:42

2 Answers2

1

You can use SQuirreL.

More Info

This is a graphical program that will allow you to view the structure a database.

Harsha W
  • 3,162
  • 5
  • 43
  • 77
  • 1
    That is subject to the same limitations as DbVisualizer: an embedded Derby database can only be accessed from within the JVM that started it –  May 16 '17 at 05:41
1

Adding answer for IntelliJ Idea 2022 UE.

Embedded persisted derby DB is created in your project directory, there should be derby.log file and db directory (after the app was launched at least once). May also check the derby.log text file whether the db was created successfully.

  • Stop application (embedded db has to be accessed by one app at at time)
  • From IntelliJ menu select: View->Tools->Database
  • On a newly opened Database panel select New->Datasource from path->Provide path to embedded directory. Also, select Driver: Apache Embedded.
  • On Data Source and Drivers Dialog select Authentication: No auth and click OK. On the same dialog switch to 'Schemas' tab and select 'All schemas'. Click OK.
  • Now the DB would be present in a pane, unfold it and unfold the SA Scheme. There it contains your tables.

Press 'deactivate' on the pane to disconnect the DB viewer prior to relaunching the application.

Kurovsky
  • 1,081
  • 10
  • 25