比如说:
String sql = "select * from clients where logname='" + name + "' and password='" + pwd + "'" ;
SQL中只支持单引号,表示字符串常量
SQL中的双引号用于表示字符串
两个加号是连接字符串
最终生成的SQL是
select * from clients where logname='xxx' and password='yyy';
上面的写法存在sql注入漏洞:
select * from clients where logname='xxx' and password='yyy' or 1='1';