I want to connect to my google cloud db using the following code.
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource"
destroy-method="close">
<property name="driverClassName" value="com.mysql.jdbc.Driver" />
<property name="url" value="jdbc:mysql://google/testDb?cloudSqlInstance=testDb:us-central1:testInst01&socketFactory=com.google.cloud.sql.mysql.SocketFactory" />
<property name="username" value="root" />
<property name="password" value="password" />
</bean>
I used this url format after reading this answer: https://stackoverflow.com/a/37646496/2399720
My application builds and updates to the google app engine ok and the home page loads but whenever I try to do something that uses the db I get this error:
HTTP ERROR: 500
org.springframework.web.util.NestedServletException: Request processing failed;
nested exception is
org.springframework.orm.jpa.JpaSystemException: Could not open connection;
nested exception is
org.hibernate.exception.GenericJDBCException
I feel like the url I'm using may be wrong and I've tried a few suggestions but they all get the same error. Thanks for taking a look!!
edit: some notes, I'm using a google flexible environment and a 2nd generation db