data parsing from a file into java and then into a mysql database

后端 未结 5 1395
借酒劲吻你
借酒劲吻你 2021-01-24 08:43

I have .Data file given in the above format . I am writing a program in java that will take the values from the .data file and put it in the buffer. MY java program is connected

5条回答
  •  走了就别回头了
    2021-01-24 09:16

    This is the fourth question for the same task... If your data file is well formatted like in the example you provided, then you don't have to split the line into values:

    Source:   "AAH196","Austin","TX","Virginia Beach","VA"
    Target:   INSERT INTO BUILDING VALUES("AAH196","Austin","TX","Virginia Beach","VA");
          <=> "INSERT INTO BUILDING VALUES(" + Source + ");"
    

    Just take a complete row from you csv file and concatenate a SQL expression.

    (see my answer to question 1 of 4 - BTW, if SQL INJECTION is a potential problem, splitting a line of values is not a solution too)

提交回复
热议问题