Doubt about sqlite in java

1

I'm currently doing my first job for a client, I'm using sqlite3 in java.

Well the question is the following, to make the project I need to create a database, and to test the program filled the database with fictitious data.

Now, what happens when I hand over the project to my client? How do you create the database tables etc. on your computer? What about the connection I make in the database?

Does the client have to install something on the computer, does he have to create his own database?

public class Conector {
   String url="C:\Users\Diego U\Documents\Christian Manager";
    Connection connect;

    public void Connect()
    {
        try {
         connect = DriverManager.getConnection("jdbc:sqlite:"+url);
         if (connect!=null) {
             System.out.println("Conectado");

         }
     }catch (SQLException ex) {
         System.err.println("No se ha podido conectar a la base de datos\n"+ex.getMessage());
     }
    }

     public void close(){
        try {
            connect.close();
        } catch (SQLException ex) {
            Logger.getLogger(Conector.class.getName()).log(Level.SEVERE, null, ex);
        }
     }

}

That's the part of my class that connects the database with java

    
asked by Diego Alejandro Uribe Blatnik 19.04.2018 в 00:42
source

1 answer

0

You could approach the problem in the following way:

  • First, create the empty database (or with absolutely essential data to make your application work from scratch) and provide it to the client so he can copy it wherever he wants. Delegating this to the client is not a good idea because it is likely that he has no idea of BD or the structure of tables that you have defined.
  • Outsource the value you assign to URL. You can put it in a properties file that you read when you start the application or pass it as a parameter at startup. When the client tells you where to leave the BD, you configure the option that you have chosen with that value and you would have it resolved (if it was as a starting parameter, next to the jar and the BD you give a boot script that "hide" that)
  • answered by 20.04.2018 / 12:02
    source