@@ -0,0 +1,910 @@
+import java.sql.Connection;%0Aimport java.sql.DriverManager;%0A%0Apublic class Connect2DB %7B%0A%09%0A%09static String connectionString = %22jdbc:hsqldb:file:db-data/mydatabase%22;%0A%0A%09public static void main(String%5B%5D args) throws Exception %7B%0A%0A%09%09Connection con = null;%0A%09%09%0A%09%09try %7B%0A%09%09%09Class.forName(%22org.hsqldb.jdbc.JDBCDriver%22);%0A%09%09%7D catch (ClassNotFoundException e) %7B%0A%09%09%09throw e;%0A%09%09%7D%0A%09%09System.out.println(%22Driver done loading%22);%0A%09%09%0A%09%09try %7B%0A%09%09%09%0A%09%09%09con = DriverManager.getConnection(connectionString, %22SA%22, %22%22);%0A%09%09%09%0A%09%09%09con.createStatement().executeQuery(%22create table if not exists %22 +%0A%09%09%09%09%09%22 contacts (name varchar(45),email varchar(45),phone varchar(45));%22);%0A%09%09%09%0A%09%09%09con.createStatement().executeQuery(%22insert into contacts%22 +%0A%09%09%09%09%09%22 values ('joe','test@tst.com','12345');%22);%0A%09%09%09%0A%09%09%09%0A%09%09%7D catch(Exception e) %7B%0A%09%09%09throw e;%0A%09%09%7D finally %7B%0A%09%09%09if(con != null) %7B%0A%09%09%09%09con.close();%0A%09%09%09%7D%0A%09%09%09System.out.println(%22All work done%22);%0A%09%09%7D%0A%09%09%0A%09%09%0A%09%7D%0A%0A%7D%0A

Create InClassExample.java