Is it necessary to create tables each time you connect the derby database?

Three common reasons for “table does not exist” when you think you’ve already created the tables:

  1. You are connecting to a different database than you think you were connecting to, and since you specified “create=true” on the Connection URL, Derby quietly created a new empty database for you.
  2. You are using the “in-memory” configuration of Derby, which means that when the database is closed (or your application exits), all the contents of the database disappear.
  3. You are connecting to the database as a different user, and you aren’t issuing the SET SCHEMA statement, so you are using the default schema name, which is based on your user name, and so the two schemas are different and have completely different tables, so the table you created doesn’t seem to exist when you use the other schema.

Leave a Comment