标签:result 一个 nbsp public creat inf jdb etc resultset
@Test
public void jdbcTest1() throws Exception {
DriverManager.deregisterDriver(new Driver());
Connection conn = DriverManager.getConnection("jdbc:mysql://47.105.71.243:3306/ngyb", "root", "123456");
String sql = "select * from `order`";
Statement statement = conn.createStatement();
ResultSet resultSet = statement.executeQuery(sql);
while (resultSet.next()) {
int id = resultSet.getInt(1);
String name = resultSet.getString(2);
int price = resultSet.getInt(3);
System.out.println(id + "--" + name + "--" + price);
}
resultSet.close();
statement.close();
conn.close();
}
}
标签:result 一个 nbsp public creat inf jdb etc resultset
原文地址:https://www.cnblogs.com/nangongyibin/p/10200473.html