how to import a csv file into a mysql from an hibernate+spring application?

后端 未结 1 1376
难免孤独
难免孤独 2021-01-16 05:15

i want to do an import of a csv file into a mysql table. The reason im doing an import is becuase i have many big files, that are sent to my server in short intervals, tried

1条回答
  •  礼貌的吻别
    2021-01-16 05:26

    Not sure I have enough information to fully answer your question, but Hibernate's Native Query facilities might let you load a file that way.

    session.createSQLQuery("LOAD DATA INFILE :filename INTO TABLE testtable (text,price)").setString("filename", "/path/to/MyFile.csv").executeUpdate();
    

    0 讨论(0)
提交回复
热议问题