Reputation: 131
I'm trying to figure out what is de default administration password. i've tried to add webAdminPassword=pass in .h2.server.properties but is not working
Upvotes: 2
Views: 7590
Reputation: 1
As Evgenij Ryazanov indicated above, the password for the "Administration Login" must first be hashed using org.h2.server.web.WebServer.encodeAdminPassword(String)
My use case: embedded H2 instance in a Spring Boot (Maven) project. The relevant dependency (h2-2.3.232.jar) existed on the class path but was marked "Visible only for test sources", so rather than modify that setting I wrote a unit test to include:
System.out.println(org.h2.server.web.WebServer.encodeAdminPassword("password_goes_here"));
and assigned the outputted hash to the application.properties file like this:
spring.h2.console.settings.web-admin-password=resulting_password_hash_goes_here
After restarting the server the Administration login worked fine. Also tested adding the property to .h2.server.properties like this:
webAdminPassword=resulting_password_hash_goes_here
and that worked equally well.
Upvotes: 0
Reputation: 8178
There is no default in H2 itself. If you have a system tray icon of H2 Console, you can open the console from its context menu and you will be able to access these features without a password in the opened window.
In all other cases you need to set up the password explicitly. You can add it to the configuration file .h2.server.properties
in the home directory of your user with webAdminPassword=some_password
(don't forget to restart the console) or you can pass it in the command line java -cp h2-1.4.200.jar org.h2.tools.Server -web -webAdminPassword some_password …
and such password will be used instead of password from the configuration file. Since H2 2.2 result of org.h2.server.web.WebServer.encodeAdminPassword(String)
must be used as value of webAdminPassword
setting or command-line parameter.
Your question does not describe how and where the H2 Console was started. If it was started on another system by another user, you need to edit the configuration file on that system in the profile of that user. If another password was passed in the startup parameters, the configuration file has no effect and you need to figure out what was passed to it.
Upvotes: 3
Reputation: 1459
With spring-boot you define the following variable in application properties: spring.h2.console.settings.web-admin-password. For standalone h2 console, you would use the solution posted by Evgenij Ryazanov.
Upvotes: 2
Reputation: 686
try this,
The answer is -user "".
else try,
name = "sa"
password = ""
In case you got stuck with the default non-blank user when running the client, the full set of parameters will get you past that:
java -cp \h2.jar org.h2.tools.Shell -url "jdbc:h2:file:" -driver "org.h2.Driver" -user "" -password ""
Please go through the below link for more info, https://www.ge.com/digital/documentation/meridium/APMConnect/V4302_UDLP210/Content/ChangeH2ConsolePassword.htm
Upvotes: 5