package application; import java.sql.Connection; import java.sql.DriverManager; import java.sql.SQLException; import java.sql.Statement; public class ConnectionBddSQLite { Connection connection = null; Statement statement = null; String pathDataBase = null; public ConnectionBddSQLite(String pathDataBase) { this.pathDataBase = pathDataBase; } protected Connection connect() { try { Class.forName("org.sqlite.JDBC"); connection = DriverManager.getConnection("jdbc:sqlite:" + this.pathDataBase); } catch(Exception e) { System.err.println("Erreur connect (method) : " + e.getMessage()); } return connection; } protected void executeQuery(String query) { try { statement = connection.createStatement(); statement.executeQuery(query); } catch(SQLException e) { System.err.println("Erreur executeQuery (method) : " + e.getMessage()); } } protected void disconnect() { try { connection.close(); } catch (SQLException e) { System.err.println("Erreur disConnect (method) : " + e.getMessage()); } } }