Fetch the repository succeeded.
import java.sql.*;
public class Example11_3 {
public static void main(String[] args) {
Connection con;
Statement sql;
ResultSet rs;
con = GetDBConnection.connectDB("Fomalhaut", "root", "*************");
if (con == null)
return;
String c1 = " year(birthday)<=2000 and month(birthday)>7";
String c2 = " name Like '张_%'";
String c3 = " height>1.65";
String sqlStr = "select*from mess where" + c1 + " and" + c2 + " and" + c3 + "order by birthday";
try {
sql = con.createStatement();
rs = sql.executeQuery(sqlStr);
while (rs.next()) {
String number = rs.getString(1);
String name = rs.getString(2);
Date date = rs.getDate(3);
float height = rs.getFloat(4);
System.out.printf("%s\t", number);
System.out.printf("%s\t", name);
System.out.printf("%s\t", date);
System.out.printf("%.2f\n", height);
}
} catch (SQLException e) {
System.out.println(e);
}
}
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。