I am using MessageFormat.format() to create the String for my PreparedStatement. I read that using StringBuilder may be a cause of sql injection. Is it the same for MessageFormat?
the code goes like this
String SQL
= "select CT.SYS_CHANGE_OPERATION, CT.{0} as ID, t.*\n"
+ "from changetable (changes {1}, ?) as CT \n"
+ "left outer join {2} as t \n"
+ "on t.{3} = CT.{4} \n"
+ "order by CT.SYS_CHANGE_VERSION";
String finalSQL = MessageFormat.format(SQL, primaryKey, table, table, primaryKey, primaryKey);
PreparedStatement pstmt = con.prepareStatement(finalSQL);