Wrong user name or password [8004-71]

1,808 views
Skip to first unread message

shahab

unread,
May 6, 2008, 8:52:29 PM5/6/08
to H2 Database, sma...@pershing.com
Hi:

I have a set up with Struts 2 + JPA + Hibernate + Postgres.

I am trying to replace postgres with H2. (H2 running as Generic H2
server mode)

when I bring up the application, I get the following error -
org.h2.jdbc.JdbcSQLException: Wrong user name or password [8004-71]
at org.h2.message.Message.getSQLException(Message.java:92)
at org.h2.message.Message.getSQLException(Message.java:96)
at org.h2.message.Message.getSQLException(Message.java:74)
at org.h2.message.Message.getSQLException(Message.java:117)
at org.h2.engine.Engine.validateUserAndPassword(Engine.java:235)
at org.h2.engine.Engine.getSession(Engine.java:109)
at org.h2.engine.Session.createSession(Session.java:229)
at org.h2.jdbc.JdbcConnection.<init>(JdbcConnection.java:976)
at org.h2.jdbc.JdbcConnection.<init>(JdbcConnection.java:957)
at org.h2.Driver.connect(Driver.java:57)
at java.sql.DriverManager.getConnection(DriverManager.java:582)
at java.sql.DriverManager.getConnection(DriverManager.java:185)
at org.h2.server.web.DbStarter.contextInitialized(DbStarter.java:39)
.......


I can access the database from console using the user id, password.
Below is the snippet for applicationContext.xml -

<bean id="entityManagerFactory"

class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
<property name="dataSource" ref="dataSource" />
<property name="jpaVendorAdapter">
<bean

class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">
<property name="database" value="HSQL" />
<property name="showSql" value="true" />
</bean>
</property>
</bean>

<bean id="dataSource"

class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName" value="org.h2.Driver" />
<property name="url" value="jdbc:h2:tcp://localhost/~/mydb" />
<property name="username" value="myid" />
<property name="password" value="mypwd" />
</bean>

Please help.

thanx
Shahab

Joshua Paine

unread,
May 7, 2008, 10:20:23 AM5/7/08
to h2-da...@googlegroups.com
The first user I created for my DB somehow ended up with a space at the
beginning of the name--I'm not sure if that's by design or a typo on my
part. Anyway, I wasn't able to connect from my web app until I created
another user (which I also made an admin for convenience) and used that.
Hope that helps.

--
Joshua Paine
LetterBlock Software
http://letterblock.com/

Thomas Mueller

unread,
May 8, 2008, 3:45:40 PM5/8/08
to h2-da...@googlegroups.com
Hi,

> org.h2.jdbc.JdbcSQLException: Wrong user name or password [8004-71]

Most likely the problem is that the database was created using another
user name and / or password. See also the 'error analyzer tool' at
http://www.h2database.com/html/sourceError.html

"The error with code 8004 is thrown when there is no such user
registered in the database, when the user password does not match, or
when the database encryption password does not match (if database
encryption is used)."

> jdbc:h2:tcp://localhost/~/mydb

In this case the database is created in the user home directory with
the name mydb. Maybe you want to delete or rename this database and
try again.

Regards,
Thomas

Reply all
Reply to author
Forward
0 new messages