Anant Nag
Anant Nag

Reputation: 23

Embedded database in play application while developing

I've a play application in which I read data from multiple files, process them and show results on the home page. When I start play in the developer mode, my homepage doesn't have any data. So I want to add an embedded database to my application so that I can save previously processed results. I'm planning to use sqlite for it but have no idea how to go about it. I've read the documentation but didn't understand how to do it. If there is a proper documentation and I've missed it, please direct me to the docs.

Upvotes: 1

Views: 196

Answers (1)

Anton Sarov
Anton Sarov

Reputation: 3748

Maybe you just missed it. Look at the documentation here: https://www.playframework.com/documentation/2.3.x/JavaDatabase

There is a sub-chapter for SQLite

# Default database configuration using SQLite database engine
db.default.driver=org.sqlite.JDBC
db.default.url="jdbc:sqlite:/path/to/db-file"

Notice that you can use the H2 in memory database for development (so that everything goes fast) and then switch to your database of choice when you are in production mode.

Upvotes: 2

Related Questions