[英]Unable to connect Cloud SQL mySql instance from Data Fusion. Exception “Could not create socket factory 'com.google.cloud.sql.mysql.SocketFactory”
Facing exception "Could not create socket factory 'com.google.cloud.sql.mysql.SocketFactory' due to underlying exception."面临异常“由于基础异常,无法创建套接字工厂'com.google.cloud.sql.mysql.SocketFactory'。” when trying to connect with mysql instance in google cloud data fusion.在谷歌云数据融合中尝试连接 mysql 实例时。
This is my pom.xml and I build the fat jar using mvn package.这是我的 pom.xml,我使用 mvn package 构建了胖 jar。
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.example</groupId>
<artifactId>mysql-with-cloud-sql-socket-factory</artifactId>
<packaging>pom</packaging>
<version>0.0.1</version>
<dependencies>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>8.0.13</version>
</dependency>
<dependency>
<groupId>com.google.cloud.sql</groupId>
<artifactId>mysql-socket-factory-connector-j-8</artifactId>
<version>1.0.15</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.4.1</version>
<configuration> <!-- get all project dependencies -->
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
<executions>
<execution>
<id>make-assembly</id> <!-- bind to the packaging phase -->
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>jar-with-dependencies</id>
<properties>
<lane>jar-with-dependencies</lane>
</properties>
</profile>
</profiles>
</project>
Use MySQL instead:使用 MySQL 代替:
Make sure you have added the relevant network in the Cloud SQL screen to allow Datafusion instance to make connection to Cloud SQL.确保您已在 Cloud SQL 屏幕中添加相关网络,以允许 Datafusion 实例连接到 Cloud SQL。 If Datafusion is running in the same project then you dont need to do anything else.如果 Datafusion 在同一个项目中运行,那么您不需要做任何其他事情。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.