You need to use preparedStatements...
PreparedStatement pStmt = connection.prepareStatement("INSERT into TEXTVALUEINVERTEDINDEX (FILEID, KEYWORD) values(?,?)"); while (tokens.hasMoreTokens()) { keyword = tokens.nextToken(); System.out.println("File= "+fileid+" Keyword="+keyword); pStmt.setString(1, fileid); //This might be pStmt.SetInt(0, fileid) depending on teh type of fileid) pStmt.setString(2, keyword); pStmt.executeUpdate(); }
then using this you can extend to us batch update...
PreparedStatement pStmt = connection.prepareStatement("INSERT into TEXTVALUEINVERTEDINDEX (FILEID, KEYWORD) values(?,?)"); while (tokens.hasMoreTokens()) { keyword = tokens.nextToken(); System.out.println("File= "+fileid+" Keyword="+keyword); pStmt.setString(1, fileid); //This might be pStmt.SetInt(0, fileid) depending on teh type of fileid) pStmt.setString(2, keyword); pStmt.addBatch(); } pStmt.executeBatch();
Not sure why your code isn't working though - but this will probably help in the long run...