im having a problem, not sure how to fix:
connection code:
public class sqliteConnection {
Connection conn=null;
public static Connection dbConnector()
{
try{
Class.forName("org.sqlite.JDBC");
Connection conn=DriverManager.getConnection("jdbc:sqlite:V:\\Database\\table.sqlite");
JOptionPane.showMessageDialog(null, "Conected to Database");
return conn;
}catch(Exception e){
JOptionPane.showMessageDialog(null, e);
return null;
}
}
}
and where im using this connection:
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
try{
String sql="insert into test (test) value (?)";
PreparedStatement pst=conn.prepareStatement(sql);
pst.setString(1, Test.getText());
}catch (Exception e){
e.printStackTrace();
}
}
im getting a '[SQLITE_ERROR] SQL error or missing database (near "value": syntax error)' error, and i cant tell where the error could come from. i just created a test table in sqlite to test the connection, with one column which is a 'TEXT' named test. any help?
Aucun commentaire:
Enregistrer un commentaire