I have a desktop program which uses an embedded data base mechanism. For the first time a user will execute a program, it must create a database. So that, next time there is a database and there is no need to create it.
How do I check if there is database and create it if necessary?
Use the
create=trueattribute in the JDBC URL, like this:See the Apache Derby Reference Manual:
You probably have to catch the
SQLWarning(this is an exception) but you could safely ignore it.