I have encountered a very strange problem: I've inserted n lines into a table, but i can just get n-1 lines in table.
The database is Access, and driver is JDBC-ODBC Bridge, code is like this:
<pre>
in = new BufferedReader(new InputStreamReader(new FileInputStream(file)));
String line, supplierId = "test";
StringTokenizer parser;
int count = 0;
while ( (line = in.readLine()) != null) {
System.out.println(line);
parser = new StringTokenizer(line, ",");
// MedId, MedCName, DemandAmount, DemandUnit, DemandPrice, ValidTime, Description
count = parser.countTokens();
if (count != 6) continue;
System.out.println("insert: " + line);
StringBuffer buf = new StringBuffer(sqlStr);
buf.append("('");
buf.append(supplierId); buf.append("','");
buf.append((String)parser.nextToken().trim()); buf.append("','"); //Medid
buf.append((String)parser.nextToken().trim()); buf.append("','"); //MedCName
buf.append((String)parser.nextToken().trim()); buf.append("','"); //SupplyAmount
buf.append((String)parser.nextToken().trim()); buf.append("','");//SupplyPrice
buf.append((String)parser.nextToken().trim()); buf.append("','");//SupplyUnit
buf.append(" ','");
buf.append(date); buf.append("',");
buf.append((String)parser.nextToken().trim()); //ValidTime
buf.append(")");
System.out.println(buf.toString());
System.out.println("insert: " + stmt.executeUpdate(buf.toString())); //return 1 to every line
}
</pre>
Who can give me answer?