-
Notifications
You must be signed in to change notification settings - Fork 0
Database Setup
By default, the application runs with an embedded Derby database. No further configuration is required. One user is created with userId = admin and password = password. This user is setup with the following roles.
ROLE_SUPERVISORROLE_SITE_ADMIN
The user can supply the database. The database needs to be created using the scripts provided in the project codebase.
-
src/main/resources/scripts/expense-tracker-create-objects.sql- This creates the objects required by the app. Ensure that you create a schema in your database under which these objects will be created. -
src/main/resources/scripts/expense-tracker-drop-objects.sql- This drops all objects created by the previous script. -
src/main/resources/scripts/expense-tracker-insert-data.sql- This adds default data into the database. You must have at least one user with roleROLE_SUPERVISORandROLE_SITE_ADMINin the database to start with, and this script does that for you.
Depending on which database you use (for example, MySQL, Oracle, DB2 etc) you will have a JDBC driver to access that database. A driver for Derby database is included in the project's dependencies. See the pom.xml file. If you use your own database like MySQL, then download the driver, and provide that as a dependency in the pom.xml. It's possible that the driver may not be available at Maven Central or another repo, so that you might have to register the driver as an artifact in your local Maven repo before your local maven builds can succeed via a mvn clean install on the command line.
Once you have the JDBC driver binary taken care of, specify the driver class name and jdbc url in the src/main/resources/expense-tracker.properties file. For Derby database, it would look something like the below.
jdbc.driverClassName=org.apache.derby.jdbc.ClientDriver
jdbc.url=jdbc:derby://localhost:1527/ExpenseDB
When you use your own database you must start the JVM in which you run your app with the following System Property.
-Dspring.profiles.active=production
If your deploying on tomcat, modify the JVM_OPTS variable in the catalina.bat (catalina.sh for *nix) script or pass it from the startup.bat (startup.sh for *nix) script.
Home | About | Setup Guide | Technical Docs | Copyright © 2013-2014 Arun Patra
ABOUT EXPENSE TRACKER
Introduction
External resources