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
- I can connect mariadb through client console, and HeidiSQL using id 'root' and password 'mypassword'.
- Default combination of mariadb server is 'utf8_general_ci'
- 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?