I have a database instance on Amazon RDS which is configured:
Amazon RDS Instance
My VPC Security group, both Inbound and Outbound are configured like below:
VPC Security Group
My VPC DNS Resolution and DNS Hostnames are activated. I can connect to this instance and execute queries without problems from MySQLWorkbench. I'm configuring it in my GAE Eclipse using persistence.xml:
<persistence-unit name="myworld">
<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider >
<!-- MODELS -->
...
<properties>
<property name="javax.persistence.jdbc.driver" value="com.mysql.jdbc.Driver"/>
<property name="javax.persistence.jdbc.url" value="jdbc:mysql://myworld.cy3caqn3kkz0.eu-west-1.rds.amazonaws.com:3306/myworld"/>
<property name="javax.persistence.jdbc.user" value="myworld"/>
<property name="javax.persistence.jdbc.password" value="******"/>
<property name="eclipselink.target-database" value="org.eclipse.persistence.platform.database.MySQLPlatform" />
</properties>
And my appengine_web.xml:
<threadsafe>true</threadsafe>
<system-properties>
<property name="java.util.logging.config.file" value="WEB-INF/logging.properties"/>
<property name="ae-cloudsql.cloudsql-database-url" value="jdbc:mysql://myworld.cy3caqn3kkz0.eu-west-1.rds.amazonaws.com:3306/myworld?user=myworld&password=******" />
<property name="cloudsql.url" value="jdbc:mysql://myworld.cy3caqn3kkz0.eu-west-1.rds.amazonaws.com:3306/myworld?user=myworld&password=******"/>
</system-properties>
I'm able to connect and execute queries when I start my GAE project locally and everything works fine but when I deploy it online I receive the following exception:
Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.5.1.v20130918-f2b9fc5): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Could not create connection to database server.
Error Code: 0
I have read lots of posts, blogs, questions and answers on stackoverflow but I didn't figured out what I'm doing wrong.
Please, any suggestion, clue, tip will be very appreciate once I'm trying to fix it for the last whole week.
Thanks you guys!
I finally could get it working!! It sounds stupid for me but it can be useful for someone who can be experiencing the same problem. Everything was fine with the projects and their configuration, the only thing I didn't do was activate the billing for my PROJECT.
Yes, you activate you billing account as soon as you create an account on GAE BUT when you create a project you need to LINK YOUR PROJECT BILLING TO THE BILLING ACCOUNT YOU HAVE CREATED.
That's it. I hope it helps someone else.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With