I built a database application using an embedded database (Java DB or HSQL), but when I run it, none of the tables or data I created are there!

Embedded databases are just that: embedded with your application. When you run your application, your application uses a database that is part of the application. It's created in a location specific to that application.

This can be confusing, but the tables and data you created in NetBeans through the Database Explorer are stored in a separate place. They won't be there when you run your application.

Unlike an application talking to a database server, an application with an embedded database needs to take responsibility for creating the database, creating the tables, and creating any initial data. This is normally done when the application starts up - you check to see if the database is there and if not create it and do any initial setup you need to do.

Java DB allows you to create the database automatically using ";create=true" in the URL, but you still need to create your tables and initial data set.

Not logged in. Log in, Register

By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo