try{Class.forName("org.gjt.mm.mysql.Driver");}catch(ClassNotFoundExceptione){System.out.println("驱动程序加载错误");}try{Connectioncon=DriverManager.getConnection("jdbc:m...
try
{
Class.forName("org.gjt.mm.mysql.Driver");
}
catch(ClassNotFoundException e)
{
System.out.println("驱动程序加载错误");
}
try
{
Connection con = DriverManager.getConnection("jdbc:mysql//127.0.0.1:3306;DatabaseName=stu","root","gao");
Statement sql = con.createStatement();
ResultSet rs =sql.executeQuery("Select * from students where english>=60");
out.println("
out.println("
");out.println("
"+"学号"+"");out.println("
"+"姓名"+"");out.println("
"+"数学成绩"+"");out.println("
"+"英语成绩"+"");out.println("
"+"物理成绩"+"");out.println("
");while(rs.next())
{
................
}
out.println("
");}
catch(SQLException e)
{
out.println("查询错误");
}
展开