代码拉取完成,页面将自动刷新
import java.sql.*;
public class city{
public static void main(String args[]) {
Connection con;
Statement sql;
ResultSet rs;
con = GetDBConnection.connectDB("world","root","sunxiaoxuan001");
if(con == null ) return;
String sqlStr =
"select * from city where Population>1016531";
try {
sql=con.createStatement();
rs = sql.executeQuery(sqlStr);
while(rs.next()) {
int ID=rs.getInt(1);
String Name=rs.getString(2);
String CountryCode=rs.getString(3);
String District=rs.getString(4);
long Population=rs.getLong(5);
System.out.printf("%d\t",ID);
System.out.printf("%s\t",Name);
System.out.printf("%s\t",CountryCode);
System.out.printf("%s\t",District);
System.out.printf("%d\n",Population);
}
con.close();
}
catch(SQLException e) {
System.out.println(e);
}
}
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。