|
|
今天使用jdbc的PreparedStatement查询语句如下:
<div class="dp-highlighter">
- Class.forName("com.mysql.jdbc.Driver");
- String url = "jdbc:mysql://localhost:3306/translate?characterEncoding=utf8";
- String sql = "select id, title, search_title, content from article";
- Connection conn = DriverManager.getConnection(url, "root", "123456");
- PreparedStatement ps = conn.prepareStatement(sql);
- ResultSet rs = ps.executeQuery();
- rs.close();
- ps.close();
- conn.close();
|
|