@@ -5,33 +5,59 @@ A Spring-Boot-Example with an unlimted an easy to configure HSQL file based _per
55### Description
66
77From time to time I need more than one _ independet_ und _ permanent_ databases to
8- * see whats going on in my tables
8+ * see whats going on in my tables during first steps of a new project
99* try out my XA-Transactions
1010* do some rapid prototyping with permanent data
1111
1212Spring-Boot Autoconfigure just provide only * one* database out of the box, if that is enough for you, stop reading..
1313to all the others ... this is comming soon ... here.
1414
15- Here is a little spoiler of the usage :-)
15+ #### Usage
1616
17+ 1 . Just clone the source
18+ 2 . Edit FileDatabaseConfig and add your DataBaseServer with different ConfigurationProperties
1719``` java
1820 @ConfigurationProperties (prefix = " cool.database" )
1921 @Bean
2022 public HSQLFileDatabaseServer coolDataBase() {
2123 return new HSQLFileDatabaseServerImpl (); // thats all, instantiate and starts the server
2224 }
23-
25+
26+ @ConfigurationProperties (prefix = " foo.database" )
2427 @Bean
25- public DataSource coolDatabaseDataSource () {
26- return coolDataBase . getBasicDataSourceForFileDatabaseServer ();
28+ public HSQLFileDatabaseServer fooDataBase () {
29+ return new HSQLFileDatabaseServerImpl (); // thats all, instantiate and starts the server
2730 }
28-
29- ...
30- and the Logging is
31-
32- Your JDBC - Connection - String : jdbc: hsqldb: hsql: // mydomain:4000/COOL_DB
31+
32+ ```
33+ 3 . edit the application.properties and add the values
34+
3335```
34- so start your favorite database tool, cut&paste the jdbc-connection String and see whats happens or use the DataSource-Bean in your code.
36+ # Cool-Database
37+ cool.database.db-name=COOL_DB
38+ cool.database.server-port=5000
39+ cool.database.db-number=1
40+ cool.database.drop-and-create=true
41+ cool.database.create-script=createTableDest.sql
42+ cool.database.fill-script=createRowsSrc.sql
43+ # Foo Database
44+ cool.database.db-name=FOO_DB
45+ cool.database.server-port=6000
46+ cool.database.db-number=3
47+ ......
48+ ```
49+
50+ 4 . put the sql-scripts in your classpath (main\resources)
51+
52+ 5 . Start the Spring-Boot Application an take a closer look at the log-File, the connection-String is there
53+ ````
54+ Your JDBC-Connection-String: jdbc:hsqldb:hsql://mydomain:4000/COOL_DB
55+ ````
56+ 6 . so start your favorite database tool, cut&paste the jdbc-connection String and see whats happens or use the DataSource-Bean in your code.
57+
58+ ##### Need more ?
59+
60+ Take a closer look at the JUnit-Tests to see how to get the Datasource bind to your configured HSQLDatabaseServer
3561
3662
3763##### Thanks
0 commit comments