How to canfigure h2 in web.xml of tomcat

1,715 views
Skip to first unread message

lanc...@gmail.com

unread,
Apr 1, 2009, 2:38:24 AM4/1/09
to H2 Database
I want to open the database when the web application starts,so i add
<listener>
<listener-class>org.h2.server.web.DbStarter</listener-class>
</listener>
to the web.xml.

however ,it says "

org.h2.jdbc.JdbcSQLException: Wrong user name or password [8004-109]
at org.h2.message.Message.getSQLException(Message.java:107)
at org.h2.message.Message.getSQLException(Message.java:118)
at org.h2.message.Message.getSQLException(Message.java:77)
at org.h2.message.Message.getSQLException(Message.java:153)
at org.h2.engine.Engine.validateUserAndPassword(Engine.java:
257)
at org.h2.engine.Engine.getSession(Engine.java:126)
at org.h2.engine.SessionFactoryEmbedded.createSession
(SessionFactoryEmb
"

Thomas Mueller

unread,
Apr 1, 2009, 3:17:50 PM4/1/09
to h2-da...@googlegroups.com
Hi,

See http://www.h2database.com/html/tutorial.html#web_applications

You need to set the database URL, user name and password.

<context-param>
<param-name>db.url</param-name>
<param-value>jdbc:h2:~/test</param-value>
</context-param>
<context-param>
<param-name>db.user</param-name>
<param-value>sa</param-value>
</context-param>
<context-param>
<param-name>db.password</param-name>
<param-value>sa</param-value>
</context-param>

If a database with that name already exists, you need to make sure
user name and password matches.

Regards,
Thomas

java funs

unread,
Apr 14, 2009, 9:40:18 PM4/14/09
to h2-da...@googlegroups.com
However, it still does not work with user/password sa/sa

2009/4/2 Thomas Mueller <thomas.to...@gmail.com>

Thomas Mueller

unread,
Apr 18, 2009, 5:21:54 AM4/18/09
to h2-da...@googlegroups.com
Hi,

> However, it still does not work with user/password sa/sa

It looks like the database was created previously with a different
user name / password combination.

Did you know the an error analyzer tool? To use it, go to the H2 home
page at http://www.h2database.com , go to "Error Analyzer", paste the
stack trace there, and click on 'Details'. You will get:

WRONG_USER_OR_PASSWORD = 8004
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). You could also view the source code (of H2) where
this exception occurs.

Regards,
Thomas

Reply all
Reply to author
Forward
0 new messages