Configuring the database connection string.
Garfio Server distribution uses HSQL as database engine. This can be configured in the files:
- /src/main/resources/ar/com/zauber/garfio/server/config/spring-postprocessing-config.xml
- /ar/com/zauber/garfio/server/config/properties/default/hsqldb.properties
In the file spring-postprocessing-config.xml the sources for the connection string are configured:
File: spring-postprocessing-config.xml
...
<bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations">
<list>
<value>classpath:/ar/com/zauber/garfio/config/properties/default/mail.properties</value>
<value>classpath:/ar/com/zauber/garfio/server/config/properties/default/hsqldb.properties</value>
<value>classpath:/ar/com/zauber/garfio/zauber/config/properties/default/cid.properties</value>
</list>
</property>
<property name="ignoreUnresolvablePlaceholders">
<value>true</value>
</property>
</bean>
...
This files includes the file hsqldb.properties ; that holds the database connection:
File:hsqldb.properties
... database.url=jdbc:hsqldb:file:src/main/hsql/garfio-dist-db database.driver=org.hsqldb.jdbcDriver database.user=sa database.password= ...
Changing to other type of databases
To change the database connection string you can write a new properties file and then change spring-postprocessing-config.xml so it points to it. For example, if you want to use !PostgreSQL you can make the following changes:
File:spring-postprocessing-config.xml
...
<bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations">
<list>
<value>classpath:/ar/com/zauber/garfio/config/properties/default/mail.properties</value>
<value>classpath:/ar/com/zauber/garfio/server/config/properties/default/postgres.properties</value>
<value>classpath:/ar/com/zauber/garfio/zauber/config/properties/default/cid.properties</value>
</list>
</property>
<property name="ignoreUnresolvablePlaceholders">
<value>true</value>
</property>
</bean>
...
File:postgres.properties
... database.url=jdbc:postgresql:garfio database.driver=org.postgresql.Driver database.user=garfio database.password=garfio ...