Load HSQLDB connection parameters from .properties file in groovlet

/ Published in: Groovy
Save to your folder(s)

Example of using .properties file for get database connection parameters into script

Copy this code and paste it in your HTML
  1. //hsqldb.properties must be in WEB_INF/classes dir for this style loading
  2. getClass().classLoader.getResource('hsqldb.properties').withReader {
  3. System.properties.load it
  4. }
  5. arg = 'dsn user pass drv'.split().collect {
  6. System.properties."hsqldb.$it"
  7. }
  8. db = Sql.newInstance(*arg)

URL: groovlet_hsqldb_properties

Report this snippet


RSS Icon Subscribe to comments

You need to login to post a comment.