Z
Z
zugzug2015-09-10 19:37:21
Java
zugzug, 2015-09-10 19:37:21

How to connect to H2/SQLite DB in Play! Framework?

Hello. I'm trying to use persistent storage in the project, as a database - H2 in a file or SQLite. With the following settings:

db.default.driver=org.h2.Driver
db.default.url="jdbc:h2:tcp://localhost/d:/play-1.2.7/samples-and-tests/zencontact/db.sqlite"

And also such
db.default.driver=org.h2.Driver
db.default.url="jdbc:h2:db.sqlite"

And even such
db.default.driver=org.h2.Driver
db.default.url="jdbc:h2:/d:/play-1.2.7/samples-and-tests/zencontact/db.sqlite"

The result is the same:
JPA error

A JPA error occurred (Cannot start a JPA manager without a properly configured database): No datasource configured

At the same time, there is a file, it is an empty db.sqlite file, located along the path:
d:/play-1.2.7/samples-and-tests/zencontact/db.sqlite

The database file is empty - 0 bytes. Those. I don't even know how it belongs to one or another DBMS. Do I need to create a file with some structure before doing this? And how is it done?
I did not find similar instructions on how to correctly connect all the same SQLite / H2 database to Play! Framework versions 1.x in a Windows environment.
OS: Windows 7.
JDK: 1.7_079
Play! versions: 1.2.7
Question: what am I doing wrong, and how to connect any of the two databases: sqlite or H2 persistent (file)? Thank you!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Artem, 2015-09-11
@mrRontgen

One and two . For your version of the play, everything is described in detail and should work. If you still can't find the datasource, then
And if it doesn’t work in this case either (which I doubt very much, since all this worked for me a long time ago), then stack traces to the studio!

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question