0

I have a servlet application running on Tomcat 7 and wish to connect to MySQL locally.

My local MySQL user does not have a password, and I wish to keep it that way for convenience.

However, if I do not use the password attribute under Resource in context.xml, it tries to connect to the DB without the username even though I have set it.

How can I connect without a password?

Below is my context.xml file, if it matters.

<?xml version="1.0" encoding="UTF-8"?>
<Context>
    <Resource
        name="jdbc/mysql"
        auth="Container"
        type="javax.sql.DataSource"
        maxActive="100"
        maxIdle="30"
        maxWait="10000"
        username="whirlwin"
        password="removeMe"
        driverClassName="com.mysql.jdbc.Driver"
        url="jdbc:mysql://localhost:3306/theDB?autoReconnect=true"/>
</Context>
0

1 Answer 1

2

Have you tried leaving empty string for the password?

If this doesn't help, post what you get running mysql -uwhirlwin -hlocalhost from the command line.

Sign up to request clarification or add additional context in comments.

1 Comment

Happens, I'm glad was able to help.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.