Annotated edit history of
hsqldbNotes version 5, including all changes.
View license author blame.
Rev |
Author |
# |
Line |
1 |
ShaneHowearth |
1 |
HSQLDB is a small database manager written in [Java]. It can be used in several modes, basically Server mode and In Process (embedded within your application) mode. But all this can be found on http://hsqldb.org/web/hsqlDocsFrame.html. |
|
|
2 |
|
5 |
ShaneHowearth |
3 |
90% of the documentation I have found for developing with HSQLDB is related to using an ide such as [Eclipse], or IntelliJ. |
1 |
ShaneHowearth |
4 |
|
|
|
5 |
If you want to dispense with those tools you can do so by following these instructions: |
|
|
6 |
|
|
|
7 |
download hsqldb from http://sourceforge.net/project/showfiles.php?group_id=23316 |
|
|
8 |
|
|
|
9 |
unzip that file, inside of which you will find a lib directory and inside of that lib directory you will find HSQLDB.jar. |
|
|
10 |
|
|
|
11 |
In the directory you are building your application unzip the HSQLDB.jar which will create a META-INF directory and a org directory |
|
|
12 |
|
|
|
13 |
The next step is a bit of coding for your application. |
|
|
14 |
I have explicitly caught all the relevant exceptions in this code, but they can all be replaced with catch (Exception e) |
|
|
15 |
|
|
|
16 |
import java.sql.*; |
2 |
ShaneHowearth |
17 |
|
1 |
ShaneHowearth |
18 |
class TestHSQLDB{ |
|
|
19 |
public static void main(String[] args){ |
|
|
20 |
try { |
|
|
21 |
|
4 |
ShaneHowearth |
22 |
/* Register the hsqldb driver to [JDBC] */ |
1 |
ShaneHowearth |
23 |
|
|
|
24 |
DriverManager.registerDriver( |
|
|
25 |
(Driver)Class.forName("org.hsqldb.jdbcDriver").newInstance()); |
|
|
26 |
|
|
|
27 |
/* Create a connection to the testdb, located in the same working directory as this code */ |
|
|
28 |
|
|
|
29 |
Connection c = DriverManager.getConnection("jdbc:hsqldb:file:testdb", "sa", ""); |
|
|
30 |
|
5 |
ShaneHowearth |
31 |
/* Handle all the exceptions */ |
1 |
ShaneHowearth |
32 |
|
|
|
33 |
}catch (java.sql.SQLException SQLe){ |
|
|
34 |
System.out.println(SQLe); |
|
|
35 |
}catch (java.lang.ClassNotFoundException CNFE){ |
|
|
36 |
System.out.println(CNFE); |
|
|
37 |
}catch (java.lang.InstantiationException IE){ |
|
|
38 |
System.out.println(IE); |
|
|
39 |
}catch (java.lang.IllegalAccessException IAE){ |
|
|
40 |
System.out.println(IAE); |
|
|
41 |
} |
|
|
42 |
} |
|
|
43 |
} |