similar question to this question but it did not help.
I have h2 deployed on a Jboss 6 server on amazon hosting at the moment. I am using the following details to attempt a connection
Connection conn = DriverManager.getConnection(
"jdbc:h2:~/test", "-user",
"");
I have tried many other combinations including the ones linked above and used the details provided in the tutorials, nothing seems to be working. The following is the stack trace.
org.h2.jdbc.JdbcSQLException: Wrong user name or password [28000-173]
org.h2.message.DbException.getJdbcSQLException(DbException.java:331)
org.h2.message.DbException.get(DbException.java:171)
org.h2.message.DbException.get(DbException.java:148)
org.h2.message.DbException.get(DbException.java:137)
org.h2.engine.Engine.validateUserAndPassword(Engine.java:302)
org.h2.engine.Engine.createSessionAndValidate(Engine.java:147)
org.h2.engine.Engine.createSession(Engine.java:122)
org.h2.engine.Engine.createSession(Engine.java:28)
org.h2.engine.SessionRemote.connectEmbeddedOrServer(SessionRemote.java:313)
org.h2.jdbc.JdbcConnection.<init>(JdbcConnection.java:105)
org.h2.jdbc.JdbcConnection.<init>(JdbcConnection.java:90)
org.h2.Driver.connect(Driver.java:73)
java.sql.DriverManager.getConnection(DriverManager.java:620)
java.sql.DriverManager.getConnection(DriverManager.java:200)
extension.Package.loadData(Package.java:477)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
java.lang.reflect.Method.invoke(Method.java:616)
org.jboss.web.tomcat.service.TomcatInjectionContainer.processesLifecycleCallbackMetaData(TomcatInjectionContainer.java:560)
org.jboss.web.tomcat.service.TomcatInjectionContainer.postConstruct(TomcatInjectionContainer.java:333)
org.jboss.web.jsf.integration.injection.JBossDelegatingInjectionProvider.invokePostConstruct(JBossDelegatingInjectionProvider.java:90)
com.sun.faces.mgbean.BeanBuilder.invokePostConstruct(BeanBuilder.java:219)
com.sun.faces.mgbean.BeanBuilder.build(BeanBuilder.java:101)
com.sun.faces.mgbean.BeanManager.createAndPush(BeanManager.java:405)
com.sun.faces.mgbean.BeanManager.create(BeanManager.java:265)
com.sun.faces.el.ManagedBeanELResolver.resolveBean(ManagedBeanELResolver.java:191)
com.sun.faces.el.ManagedBeanELResolver.getValue(ManagedBeanELResolver.java:73)
javax.el.CompositeELResolver.getValue(CompositeELResolver.java:175)
com.sun.faces.el.FacesCompositeELResolver.getValue(FacesCompositeELResolver.java:71)
org.apache.el.parser.AstIdentifier.getValue(AstIdentifier.java:67)
org.apache.el.parser.AstValue.getValue(AstValue.java:115)
org.apache.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:187)
com.sun.faces.facelets.el.TagValueExpression.getValue(TagValueExpression.java:106)
javax.faces.component.ComponentStateHelper.eval(ComponentStateHelper.java:190)
javax.faces.component.ComponentStateHelper.eval(ComponentStateHelper.java:178)
javax.faces.component.UIOutput.getValue(UIOutput.java:164)
com.sun.faces.renderkit.html_basic.HtmlBasicInputRenderer.getValue(HtmlBasicInputRenderer.java:201)
com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.getCurrentValue(HtmlBasicRenderer.java:351)
com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.encodeEnd(HtmlBasicRenderer.java:160)
javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:879)
com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.encodeRecursive(HtmlBasicRenderer.java:308)
com.sun.faces.renderkit.html_basic.GridRenderer.renderRow(GridRenderer.java:181)
com.sun.faces.renderkit.html_basic.GridRenderer.encodeChildren(GridRenderer.java:125)
javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:849)
javax.faces.component.UIComponent.encodeAll(UIComponent.java:1643)
javax.faces.render.Renderer.encodeChildren(Renderer.java:164)
javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:849)
javax.faces.component.UIComponent.encodeAll(UIComponent.java:1643)
javax.faces.component.UIComponent.encodeAll(UIComponent.java:1646)
javax.faces.component.UIComponent.encodeAll(UIComponent.java:1646)
com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:389)
com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:127)
javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:269)
com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:117)
com.sun.faces.lifecycle.Phase.doPhase(Phase.java:97)
com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:135)
javax.faces.webapp.FacesServlet.service(FacesServlet.java:309)
Any help on where I am going wrong would be greatly appreciated. Thank you.
I had exactly the same problem once : I could not access to an H2 file-based database. I never specify any user of password for H2 databases. When I had the connection problem "Wrong user name or password", there was already an existing file from a previous run of the application. Removing the existing *.db files solved the problem (I guess it was created with a generated user/password couple, which has changed since).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With