Fork me on GitHub
Subscribe to RSS Feed

Kit Plummer
Software Engineer :: Techitect :: Evangelist
kitplummer (AIM,Yahoo!IM,Gtalk,Skype)

To the top »

Please share:

After some searching of the typical sources I’d found this post a different question. But, the answer has turned out to be to enable the HSQLDB under GORM to run in server mode.

        java -cp ./lib/hsqldb- org.hsqldb.Server -database.0 mem:devDb -dbname.0 devDb

Then, just set the dataSource to look like this:

        dataSource {
			dbCreate = "create-drop" // one of 'create', 'create-drop','update'
			//url = "jdbc:hsqldb:file:devDB;shutdown=true"
			url = "jdbc:hsqldb:hsql://localhost:9001/devDb"

Now, the SQL stuff in the bundle is pretty straight forward:

        try {
		} catch (ClassNotFoundException e) {

		System.out.println("DATA -> XMLSTRING: " + data);

		try {
			Connection con = DriverManager.getConnection
				( "jdbc:hsqldb:hsql://localhost:9001/devDB", "sa","");

			Statement stmt = con.createStatement();
			ResultSet rs = stmt.executeQuery("SELECT * FROM RESOURCES");

Although this route might seem like a hack, it really is just the quickest, and lightest way to get things glued … so I’m pretty happy. I’m not sure what affect running port 9001 for the HSQLDB will have, and I can’t think of a good reason why it matters.

If only I could get Grails to launch the database in server mode, instead of having to launch it manually. I suppose there’s a Maven or Ant task in the near future.

Please comment:
blog comments powered by Disqus