Spero che qualcuno possa aiutarmi. Sto lavorando su una semplice applicazione che si connette con un database SQLite. Di seguito è riportato il mio codice di connessione:Nessun driver adatto trovato (SQLite)
try {
Connection con = DriverManager.getConnection("jdbc:sqlite:myDB.sqlite");
PreparedStatement pstm = con.prepareStatement("insert into hell(username,pssword) " +
"values ('"+tfUname.getText()+"','"+tfUpass.getText()+"')");
pstm.close();
con.close();
JOptionPane.showMessageDialog(null,"Congrats, you have been registered succesfully");
RegisterWindow rw = new RegisterWindow();
rw.setVisible(false);
pack();
dispose();
} catch(SQLException ex) {
setTitle(ex.toString());
}
Questa è solo una finestra per caricare un nome utente e una password nel database. Il problema che ho è che quando faccio clic sul pulsante appare la seguente eccezione:
"java.sql.SQLException: No suitable driver found for jdbc:sqlite:C\\LoginJava2\\myDB.sqlite"
(ho trovato un esempio su come connettersi a un database SQLite in Java, l'esempio che ho trovato funziona bene)
Questo programma lo sto facendo in window builder (eclipse). Sto usando lo stesso driver che uso nell'esempio che ho trovato. Non so se devo usare un altro driver. In effetti, ho provato con driver diversi ma quel messaggio appare ancora.
[Vedi qui JDBC PreparedStatement Example] (http://www.mkyong.com/jdbc/jdbc-preparedstatement-example-batch-update/) – Smit
[JDBC + SQLite: DriveManager non carica il driver necessario] (http: //stackoverflow.com/questions/13637389/jdbc-sqlite-drivemanager-does-not-loadedne-driver) – Smit
Questo non sembra un URL valido. –