It is really easy to get up and running with HSQLDB.
- Download HSQLDB from here.
- Add
hsqldb.jar
to your classpath. - Create a connection like this:
Class.forName("org.hsqldb.jdbc.JDBCDriver"); Connection conn = DriverManager.getConnection( "jdbc:hsqldb:mem:mydb", "SA", "");
- Create a table like this:
String bookTableSQL = "create memory table MY_TABLE ("+ " TITLE varchar(256) not null primary key,"+ " AUTHOR varchar(256) not null"+ ");" Statement st = conn.createStatement(); st.execute(bookTableSQL);
- You can then insert records into the table and query it just as you would with an ordinary database table.
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.