Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 574
Abel Jojo Avatar asked Dec 01 '22 23:12

Abel Jojo


2 Answers

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.

like image 99
Pablo Santa Cruz Avatar answered Dec 09 '22 12:12

Pablo Santa Cruz


According to http://db.apache.org/derby/docs/10.4/ref/rrefattrib26867.html it:

Creates the standard database specified within the database connection URL Derby system and then connects to it.

So I'd say that no, you shouldn't have that in all your connection urls; only when you specifically want the db to be created if it doesn't exist.

like image 31
Thor84no Avatar answered Dec 09 '22 11:12

Thor84no