当前位置:Gxlcms > 数据库问题 > hsqldb使用

hsqldb使用

时间:2021-07-01 10:21:17 帮助过:6人阅读

static void main(String[] args) throws SQLException { try { Class.forName("org.hsqldb.jdbc.JDBCDriver"); } catch (ClassNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } Connection conn = DriverManager.getConnection("jdbc:hsqldb:hsql://localhost/my", "sa", ""); Statement stmt = conn.createStatement(); ResultSet rs = stmt.executeQuery("select id, firstname, lastname from customer"); while (rs.next()) { System.out.println("id: " + rs.getInt("id")); System.out.println("firstname: " + rs.getString("firstname")); System.out.println("lastname: " + rs.getString("lastname")); } } /* id: 1 firstname: Asn lastname: Judy */

 

hsqldb使用

标签:

人气教程排行