jeudi 21 avril 2016

How-to Maintain DB Java Connection

I have a .db file in GitHub (same level as my src folder) so I can now commit/push it with the rest of my files. How do I make sure that the connection from my Java code to the SQLite database stays valid once it is loaded onto another user's system? Can I just stick with

connection = DriverManager.getConnection("jdbc:sqlite:mydatabase.db");

or do I need to rework the path? SQLite creates a new empty db if it doesn't find the one it's looking for, so I want to make sure it actually connects.

(I imagine the best solution would involve Maven or Ant, but I haven't actually learned how to use those yet.)

Aucun commentaire:

Enregistrer un commentaire