预编译sql 的,例如 preparedStatement("select * from t where id = ?");然后传入参数的时候 ? 就会替换成你所需要的参数。也可以时候 createStatement, 但是这个会有 sql 注入的问题