Created
May 17, 2012 06:52
-
-
Save fukayatsu/2717075 to your computer and use it in GitHub Desktop.
PreparedStatementを使う時の注意
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//String sql = "SELECT * FROM user where name = '?'"; //エラー | |
String sql = "SELECT * FROM user where name = ?"; //OK | |
PreparedStatement ps = conn.prepareStatement(sql); | |
ps.setString(1, userName); | |
ResultSet rs = ps.executeQuery(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment