I'm trying to connect to my hsqlDb via java script but what ever i add in the db it can't be saved and it doesnt generate any error ! the same when i try to get data from the db and i use Result.next() it generete nulPointerExeption even i have data in my table
Connection con = null;
try {
Class.forName("org.hsqldb.jdbcDriver");
con = DriverManager.getConnection("jdbc:hsqldb:file:GestionPiecesDB\\GestionPiece;hsqldb.lock_file=false", "root", "");
} catch (SQLException e) {
System.out.println(e);
} catch (ClassNotFoundException ex) {
Logger.getLogger(DataBaseTest.class.getName()).log(Level.SEVERE, null, ex);
}
System.out.print("connected \n");
Statement stmn;
try {
stmn = con.createStatement();
stmn.executeUpdate("insert into users (nom ,nature , mot_passe ) values ('admin' ,'admin' , 'admin')");
} catch (SQLException ex) {
}
System.out.print("created \n");
Statement sn;
ResultSet r ;
try {
sn = con.createStatement();
r = sn.executeQuery("select * from users");
if(r.next())
System.out.print("value \n");
else
System.out.print("not value \n");
} catch (SQLException ex) {
}