(Reproduced) ibatis: Solves the SQL Injection problem, ibatissql
Address: http://blog.csdn.net/scorpio3k/article/details/7610973
You can use the # And $ methods for ibaits parameter reference. The # method uses the pre-compilation method, and the escape is handed over to the database, so there is no injection problem. If $ is used, it is equivalent to concatenating strings, which causes injection problems.
For example, if the attribute value is "'or '1' = '1', there is no problem with the # method, and the $ method is used.
For the like statement, it is inevitable that the $ statement is used,
1. Oracle can be avoided through '%' | '# param #' | '%;
2. MySQL can be avoided through CONCAT ('%', # param #, '%;
3. Use '%' + # param # + '% in MSSQL.
Mysql: select * from t_user where name like concat ('%', # name #, '% ')
Oracle: select * from t_user where name like '%' | # name # | '%' SQL Server: select * from t_user where name like '%' + # name # + '%