0

First of all, I am sorry, I am not good at English.

Hi! I have some problems about connecting mariaDB from Java web project using tomcat connection pool and JNDI.

Here are Exception logs from eclipse console.

java.sql.SQLException: Cannot create PoolableConnectionFactory (Access denied for user 'root'@'localhost' (using password: YES))
    at org.apache.tomcat.dbcp.dbcp2.BasicDataSource.createPoolableConnectionFactory(BasicDataSource.java:735)
    at org.apache.tomcat.dbcp.dbcp2.BasicDataSource.createDataSource(BasicDataSource.java:605)
...(etc)
Caused by: java.sql.SQLInvalidAuthorizationSpecException: Access denied for user 'root'@'localhost' (using password: YES)
    at org.mariadb.jdbc.internal.util.exceptions.ExceptionMapper.get(ExceptionMapper.java:238)
...(etc)
Caused by: java.sql.SQLException: Access denied for user 'root'@'localhost' (using password: YES)
Current charset is UTF-8. If password has been set using other charset, consider using option 'passwordCharacterEncoding'
...(etc)

and I set connection pool information into Tomcat server context.xml file like this

<Resource 
        name = "jdbc/maria" 
        auth = "Container"
        type = "javax.sql.DataSource"
        driverClassName = "org.mariadb.jdbc.Driver"
        url="jdbc:mysql://localhost:3306/pcj01142"
        username = "root"
        password = "mypassword"
        maxActive="50" 
        maxWait = "-1"/>

and There are some facts that

  1. I can connect mariadb through client console, and HeidiSQL using id 'root' and password 'mypassword'.
  2. Default combination of mariadb server is 'utf8_general_ci'
  3. There is a database in mariadb server which is named 'pcj01142'

Here are some attempts I have tried to fix my problem but doesn't work

  • Reinstalling mariadb and apache tomcat9
  • Resetting root user password
  • Adding new user which have all privileges
  • Stoping DB server and restarting

I also tried to start tomcat itself not through the eclipse but, result was same.

How can I fix this problem?

0

I solved this problem myself.

The problem was collision between MySQL and MariaDB using same port number(3306).

When I stoped MySQL, problem wad solved.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.