I am using a java class which allow me to insert data into SQLite database from string. I am inserting the data by a loop. My string have 260 data. When I try to insert those data from string to sqlite database it works fine but stops at the position of 254 every time! Why ?!
for(i = 0; i < 260; i++)
{
try {
Class.forName("org.sqlite.JDBC");
connection = DriverManager.getConnection("jdbc:sqlite:D:\\new.db");
java.sql.Statement statement = connection.createStatement();
statement .executeUpdate("INSERT INTO suggestion (suggesting) VALUES('"+words[i]+"')");
System.out.println(i + " - " + words[i]);
} catch (ClassNotFoundException ex) {
Logger.getLogger(Word.class.getName()).log(Level.SEVERE, null, ex);
}
}
Here is the error log from netbeans!
Exception in thread "main" java.lang.NullPointerException at org.sqlite.NestedDB$CausedSQLException.fillInStackTrace(NestedDB.java:442) at java.lang.Throwable.(Throwable.java:250) at java.lang.Exception.(Exception.java:54) at java.sql.SQLException.(SQLException.java:140) at org.sqlite.NestedDB$CausedSQLException.(NestedDB.java:435) at org.sqlite.NestedDB._open(NestedDB.java:63) at org.sqlite.DB.open(DB.java:77) at org.sqlite.Conn.(Conn.java:88) at org.sqlite.JDBC.connect(JDBC.java:64) at java.sql.DriverManager.getConnection(DriverManager.java:571) at java.sql.DriverManager.getConnection(DriverManager.java:233) at test.Word.main(Word.java:106) Java Result: 1
Aucun commentaire:
Enregistrer un commentaire