面对异常“由于基础异常,无法创建套接字工厂'com.google.cloud.sql.mysql.SocketFactory'。” 在Google Cloud Data Fusion中尝试与mysql实例连接时。
这是我的pom.xml,我使用mvn包构建了胖子。
<?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>
答案 0 :(得分:0)
改为使用MySQL:
确保已在Cloud SQL屏幕中添加了相关网络,以允许Datafusion实例连接到Cloud SQL。如果Datafusion在同一项目中运行,则您无需执行其他任何操作。