javadatabase-connectionderbyjavadb

what is 'create=true' , connection javadb?


jdbc:derby:myDatabase;create=true

what does create=true mean? Should all connetionurls hould have this create=true or just user and psw?

Advanced thanks


Solution

  • create=true in this context means that database will be created if it does not exist. You can avoid using that parameter if you don't need it.

    From the documentation:

    Creates the standard database specified within the database connection URL Derby system and then connects to it. If the database cannot be created, the error appears in the error log and the connection attempt fails with an SQLException indicating that the database cannot be found.

    If the database already exists, creates a connection to the existing database and an SQLWarning is issued.