i am reading a text file and inserting the data into a database.
the format of my text file is as follows:
item ID
desc
stock level
reOrder level
isReordered
i have no trouble reading the data in and inserting it into my DB.
however i wish to have a gap before the next lot of information in
the text file e.g.
...
isReordered
item2 ID
etc...
here is my code:
statement = conn.createStatement();
try {
for(int i = 1; i < 3; i++) {
String in1 = bufferReader.readLine();
String in2 = bufferReader.readLine();
int in3 = Integer.parseInt(bufferReader.readLine());
int in4 = Integer.parseInt(bufferReader.readLine());
int in5 = Integer.parseInt(bufferReader.readLine());
String in6 = bufferReader.readLine();
query = "INSERT INTO Items(itemID, description, stockLevel,
reorderLevel, isReordered, reorderDate) VALUES('" + in1 + "', '" +
in2 + "', '" + in3 + "', '" + in4 + "', '" + in5 + "', '" + in6
+ "')";
statement.executeUpdate(query);
}
}catch(Exception e) {
System.out.println("too many records");
}