📄 hello.java
字号:
package net.aetherial.gis.test.hsql;
import java.sql.*;
/**
* <p>Title: </p>
*
* <p>Description: </p>
*
* <p>Copyright: Copyright (c) 2004</p>
*
* <p>Company: </p>
*
* @author not attributable
* @version 1.0
*/
public class Hello {
public Hello() {
}
public void test(){
Connection c = null;
try {
Class.forName("org.hsqldb.jdbcDriver");
c = DriverManager.getConnection("jdbc:hsqldb:file:db/testdb", "sa", "");
Statement stmt = c.createStatement();
try {
stmt.executeUpdate("create table test(a int,b varchar(30)) ");
}
catch (SQLException ex1) {
}
stmt.executeUpdate("insert into test(a,b) values(10,'測試') ");
stmt.executeUpdate("insert into test(a,b) values(15,'data') ");
ResultSet rs = stmt.executeQuery("select * from test");
stmt.execute("SHUTDOWN");
while (rs.next()) {
System.out.println(rs.getString(1) + "," + rs.getString(2));
}
c.close();
}
catch (Exception ex) {
ex.printStackTrace();
}
}
public static void main(String[] args) {
Hello hello = new Hello();
hello.test();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -