0

I know there are a couple of questions on the topic here but they don't seem helpful to me.

I have an SQLite Database in my Eclipse project (Sanus is the name of my project):

Eclipse PorojectEclipse

When I export to JAR in Eclipse and I run the JAR the application is not talking to the database anymore. I don't know if the path is different or what.

If I zip and unzip the JAR I see this:

enter image description here

This is a method I use to call the database and retrieve data:

    public static String Login(String un){
        Statement statement = null;
        try {
          Class.forName("org.sqlite.JDBC");
          connection = DriverManager.getConnection("jdbc:sqlite:PatientRegistry.sqlite");
          connection.setAutoCommit(false);
          String password=null;
          statement = connection.createStatement();
          ResultSet rs = statement.executeQuery( "SELECT password, fullName FROM users WHERE username = '"+un+"';" );
          while ( rs.next() ) {
             password = rs.getString("password");
             MainClass.userFullName = rs.getString("fullName");
          }
          rs.close();
          statement.close();
          connection.close();
          return password;
        } catch ( Exception e ) {
          System.out.println("There's a problem with the database.");
          return null;
        }
    }
ocram
  • 1,384
  • 6
  • 20
  • 36

0 Answers0