// 查询语句 String sql = "SELECT description FROM production.product WHERE productid=1"; // 创建语句对象 Statement stmt = conn.createStatement(); // 执行查询 ResultSet rs = stmt.executeQuery(sql); // 显示结果集 while (rs.next()) { try { Reader reader = rs.getCharacterStream("description"); BufferedReader br = new BufferedReader(reader); String thisLine; while ((thisLine = br.readLine()) != null) { System.out.println(thisLine); } } catch (IOException e) { e.printStackTrace(); } } // 关闭结果集 rs.close(); // 关闭语句 stmt.close();
https://xpanx.com/
评论