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

后端 未结 1 705
深忆病人
深忆病人 2020-11-27 09:01

I created a schema and few tables manually using the Eclipse database development perspective. But whenever I try to access the table from code, I get \"Schema does not exis

相关标签:
1条回答
  • 2020-11-27 09:15

    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.
    0 讨论(0)
提交回复
热议问题