To create one, your jdbc url will be: jdbc:derby:foo;create=true
, and it will create a database called foo in the derby system directory. If you want to create one in an absolute location on your hard drive, specify an absolute path. jdbc:derby:/home/me/foo;create=true
.
Once the database is created, you can connect to it with the same url, or you can drop the ;create=true
part off.
You can set the derby system directory via system properties, e.g. System.setProperty("derby.system.homeSystem.setProp", "/home/bar/whatever");
. I think you would need to do this before starting a derby database has been started, but I've never tried to do it afterwards. I have found that setting the derby system home for the app and specifying relative database url to work better, but that's a personal preference.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…