Un saludo! Les comento q logro conectarme a mi BD Sqlite pero no puedo insertar datos. Q sucede?
Conectado
org.sqlite.SQLiteException: [SQLITE_ERROR] SQL error or missing database (no such table: VISITORS)
at org.sqlite.core.DB.newSQLException(DB.java:909)
at org.sqlite.core.DB.newSQLException(DB.java:921)
at org.sqlite.core.DB.throwex(DB.java:886)
at org.sqlite.core.NativeDB.prepare_utf8(Native Method)
at org.sqlite.core.NativeDB.prepare(NativeDB.java:127 )
at org.sqlite.core.DB.prepare(DB.java:227)
at org.sqlite.jdbc3.JDBC3Statement.executeQuery(JDBC3 Statement.java:81)
at SqlitePruebas.main(SqlitePruebas.java:14)
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.sql.Statement;
public class SqlitePruebas {
public static void main(String[] args) {
try {
Connection konetCAGB = ConectionPrueba.ConnectCAGB();
Statement statementB4 = konetCAGB.createStatement();
String codigosql = "INSERT INTO VISITORS (House, Name, LastName, License, Company) VALUES ('9935', 'SANDRA', 'ROJAS', 'R254236-3', 'LOS VERDES');";
statementB4.executeQuery(codigosql);
konetCAGB.close();
} catch (SQLException e1) {
e1.printStackTrace();
}
}
}
class ConectionPrueba {
static Connection con = null;
public static Connection ConnectCAGB(){
try{
Class.forName("org.sqlite.JDBC");
Connection con = DriverManager.getConnection("jdbc:sqlite:DatabaseC ontrolAccessGB.sqlite");
System.out.println("Conectado");
return con;
}catch(Exception e){
System.out.println("No Conectado");
return con = null;
}
}
}