0
我需要查詢數據庫,但參數值從查詢需要來自一個文件,這裏是代碼...如何動態添加參數值到JdbcTemplate查詢?
BufferedReader reader = new BufferedReader(new FileReader("C:/DBMigrations/empIDs.txt"));
String line = null;
String query = "select name, address from Employee where id in (";
while ((line = reader.readLine()) != null) {
// the value of line needs to be plugged into query inside the in clause
}
我使用Spring的SimpleJdbcTemplate進行。
在此先感謝您的幫助。
的字符串內容的想法你要創建對應於單行文件單獨的SQL?意思是你會有多個查詢 – Kick