Reputation: 10558
I am trying to use an H2
database with Java
. I cannot seem to find out where the data is being written.
The database URL I am giving is: jdbc:h2:/db/bh
.
I am connecting with the database using Java
like so:
dbObj.setDBConnection(DriverManager.getConnection(hObj.getDBUrl(), hObj.getDBUsername(), hObj.getDBPassword()));
where DB URL is given above.
Username: sa
Password: (empty).
I am running the jar
from within the following folder:
C:\work\sampleH2\sampleH2.jar
My understanding of the FAQ section of H2 says that the database bh
will be found in the folder db/
of the folder sampleH2
. But that is not the case. Where can I find it?
Upvotes: 1
Views: 4049
Reputation: 31
the user and pass are stored in you C:\Users\tony as a file
with the extension name .mv.db and the name that you put in your application.properties spring.datasource.username = mydb
ex:
mydb.mv.db
You have to delete this file.
Upvotes: 0
Reputation: 14550
According to H2 Database Engine Cheat Sheet there is a difference between storing in:
See Absolute and relative paths in Wikipedia.
So I would look for it on your main drive (probably c:) under path you specified.
Upvotes: 2