The problem with hibernate cannot connect to the database:
ERROR:HHH000231:Schema Export unsuccessful
(Access denied for user ' root ' @ ' 192.168.1.109 ' (using Password:no)
At Org.apache.commons.dbcp.BasicDataSource.createPoolableConnectionFactory (basicdatasource.java:1549)
At Org.apache.commons.dbcp.BasicDataSource.createDataSource (basicdatasource.java:1388)
Configured as follows
@Beanpublic DataSource DataSource () {Basicdatasource DataSource = new Basicdatasource ();d atasource.seturl ("Jdbc:mysql ://localhost:3306/shopping ");d atasource.setdriverclassname (" Com.mysql.jdbc.Driver "); Datasource.setusername ("root"); Datasource.setpassword (""); return dataSource;}
That is to say that hiberate the localhost to 192.168.1.109 is the computer above the Ip,mysql will be considered a remote access, but MySQL is not configured such a host, in fact, MySQL configuration has been configured with localhost and 127.0.0.1 Two ways of matching.
So why does hibernate not parse localhost into 127.0.0.1?
There are many kinds of solutions:
1. Modify Hibernate configuration to
Jdbc:mysql://127.0.0.1:3306/shopping
2. Modify MySQL
Add an 192.168.1.109 IP right
3. How to modify MySQL once, then hibernate using localhost has been able to access MySQL, I think you can build a middle tier, to match the current computer's IP as long as the match, you can log in
Configure the host to Dongfusong.local, as long as the dongfusong.local can dynamically match the computer's IP to be able.
Hibernate connection Database problem Org.apache.commons.dbcp.SQLNestedException:Cannot Create Poolableconnectionfactory