<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
<persistence-unit name="ContactUsPU">
<provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>
<properties>
<property name="hibernate.dialect" value="org.hibernate.dialect.MySQL57InnoDBDialect" />
<property name="hibernate.hbm2ddl.auto" value="none" />
<property name="hibernate.connection.driver_class" value="com.mysql.jdbc.Driver" />
<property name="hibernate.connection.url"
value="jdbc:mysql://google/yyyyyy?cloudSqlInstance=bbhwebapp:asia-southeast1:bbh-db&socketFactory=com.google.cloud.sql.mysql.SocketFactory&useSSL=false"/>
<property name="hibernate.connection.username" value="xxxx" />
<property name="hibernate.connection.password" value="xxx" />
<property name="hibernate.archive.autodetection" value="class" />
<property name="hibernate.show_sql" value="true" />
<property name="hibernate.format_sql" value="true" />
<property name="hibernate.use_sql_comments" value="true" />
<property name="hbm2ddl.auto" value="none" />
<property name="hibernate.connection.autocommit" value="true"/>
</properties>
</persistence-unit>
</persistence>
Hello,
Please review the following docs on how to connect to Cloud SQL instance from application running on App Engine Standard environment or App Engine Flexible environment as they elaborate about the process.
This link of GitHub contains the example program that shows how to use Hibernate on App Engine when connecting to Cloud SQL. Just for your information, please use Google App Engine Standard Environment if you are using for Hibernate version 4.2.0 or earlier and Google App Engine Flexible Environment with later versions of Hibernate in order to avoid the issue described here.