I am trying to connect to my database from the Google Flexible Environment to the Google Cloud SQL. The connection string and the driver class are shown below:
<bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName" value="com.mysql.jdbc.GoogleDriver" />
<property name="url" value="jdbc:google:mysql://mz-test:us-central1:mz-life-cloudsql-prod/mz_db" />
<property name="username" value="root" />
<property name="password" value="" />
</bean>
However, I am currently getting
org.springframework.beans.factory.BeanCreationException:
Error creating bean with name 'dataSource' defined in ServletContext resource [/WEB-INF/classes/context/applicationContext-jooq.xml]:
Error setting property values; nested exception is org.springframework.beans.PropertyBatchUpdateException;
nested PropertyAccessExceptions (1) are:|PropertyAccessException 1: org.springframework.beans.MethodInvocationException: Property 'driverClassName' threw exception;
nested exception is java.lang.IllegalStateException: Could not load JDBC driver class [com.mysql.jdbc.GoogleDriver]
The database I am trying connecting to is a Second Generation Cloud SQL MySQL database.
Why am I getting this exception?
The App Engine had this <use-google-connector-j>
property. I've not seen this property for the Flexible Environment - at least not on those pages what I've been reading so far. Is there anything I'd have to set in addtion in my app.yaml file?
Not sure if I have to do this in Flexible Environment but I am currently trying to set the use-google-connector-j
property to true in my yaml file:
use-google-connector-j: true
but it appears this is not working at the moment: https://code.google.com/p/googleappengine/issues/detail?id=11444
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…