Correct Apache Derby database location and connection URL using Maven?

Viewed 182

I'm using NetBeans 12.4, JavaFX, Maven, Apache Derby & JLink.

I'm confused as to where I should locate my database files and what connection url I should use to connect to it. If I locate the db in src/main/resources/db/MYDATABASE and use:

jdbc:derby:target/classes/db/MYDATABASE/

or

jdbc:derby:src/main/resources/db/MYDATABASE/

and then run the application within NetBeans it works as expected but if I use javafx:jlink to produce a zip file and attempt to run that, the application complains that it can't connect to the db.

So what is the correct place to put the db and what would the correct connection url be?

Thanks in advance,

Fred.

Edit: Maybe I have haven't worded this question very well. So I'll rephrase the question as:

1 - In which folder should a Derby database go when using Maven?

2 - What should the url be to connect to the said database?

If I can be certain that I have at least the above parts correct then I can possibly figure out the javafx jlink part of the problem myself.

Edit: No, I haven't decided on a solution (although I have tried different solutions) but I definitely did make the question too complex by including the part about jLinking.

Therefore, although I'm a long term NetBeans/Java/Derby/Swing/Ant user I'm a first time Maven user and its Maven's use of a resources folder that has thrown me. So the simplified problem is, I am writing a JavaFX application and I have correctly placed the FXML files in the resources directory as Maven requires and I load them using getClass().getResource("fxmlfolder"); but I'm unsure as to where my Derby database files should go and what the correct connection url should be so that my application runs both from within NetBeans, using the jar file that it itself generates, and hopefully maybe even when jLinked also?

If anybody else who has used Derby with Maven could let me know how they did it I would appreciate being informed.

0 Answers
Related