0

hi my app is based on spring-hibernate.Database is mysql. I imported my db with phpmyadmin in jelastic. hibernate connection detail

 <property name="url"
                value="jdbc:mysql://mysql-estate.jelastic.servint.net/realestate" />
            <property name="username" value="root" />
            <property name="password" value="password" />

after i deployed my war file and shows following error on browser..

message Request processing failed; nested exception is org.springframework.transaction.CannotCreateTransactionException: Could not open JDBC Connection for transaction; nested exception is org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (Access denied for user 'root'@'192.168.3.21' (using password: YES))

boycod3
  • 5,033
  • 11
  • 58
  • 87

1 Answers1

2

Mysql won't allow root connections from any host by default. You've got to whitelist account access. A better way to do this would be to create a mysql user for your application, and give that user remote login privileges.

Here's how you do that: CREATE USER 'jeffrey'@'localhost' IDENTIFIED BY 'mypass'; GRANT ALL ON db1.* TO 'jeffrey'@'localhost';

Note that when specifying a user you are required to specify a host.

zmf
  • 9,095
  • 2
  • 26
  • 28
  • yes url is correct, the error message you're receiving indicates that you are connecting to the database, but the credentials you're using are not valid. you need to allow access to the database from a specific user and host. – zmf May 30 '14 at 16:15
  • cleared above problem. now it is showing java.net.UnknownHostException: mysql.hibernate.estate.jelastic.servint.net error....!! my environment name:-estate.jelastic.servint.net/ i refereed the link http://docs.jelastic.com/jelastic-db-hibernate – boycod3 May 30 '14 at 20:14