I’m trying to set a custom password for the sa user. My application.conf contains
db=mem
db.url=jdbc:h2:mem:play;MODE=MYSQL
db.driver=org.h2.Driver
db.user=sa
db.pass=newpass
…and the play framework appears to be overriding it inside play.db.DBPlugin
if(p.getProperty("db.url") != null && p.getProperty("db.url").startsWith("jdbc:h2:mem:")) {
p.put("db.driver", "org.h2.Driver");
p.put("db.user", "sa");
p.put("db.pass", "");
}
How can I get around this?
As far as I’m aware this is because H2 in memory mode uses a default user/password, as it’s a RAM based db and it will be removed when the application stops and any changes to the user will be lost.
To avoid this you have to either use a “file” (not “mem”) instance of H2 or some other database.
I can’t think of an scenario where you want a memory database and changing the password is relevant. Could you explain the scenario and why you want to change the password? Maybe we can help by pointing an alternative.