Java与JavaEE实习指导书v0.5(20)
发布时间:2021-06-07
发布时间:2021-06-07
System.out.println("Av. age: " + result.getDouble(1)); } System.out.println(); // List the names of all the people that live in Africa result = statement.executeQuery("SELECT name FROM Person WHERE lives_in = 'Africa' "); System.out.println("All people that live in Africa:"); while (result.next()) { System.out.println(" " + result.getString(1)); } // Close the statement and the connection. statement.close(); connection.close(); } catch (SQLException e) { System.out.println("An SQLException occurred: " + e.getMessage()); } catch (Exception e) { e.printStackTrace(System.err); } } }
4.2.2. 编译运行
添厍HSQLDB.jar到项目的“Build Path”中,然后运行,测试程序。
上一篇:be702e压缩机手册