whhe commented on PR #4626:
URL: https://github.com/apache/seatunnel/pull/4626#issuecomment-1610610259
> Yes, there's a better way. You can change it.
> […](#)
> ------------------ 原始邮件 ------------------ 发件人:
"apache/seatunnel" ***@***.***>; 发送时间: 2023年6月27日(星期二) 晚上8:04
***@***.***>; ***@***.******@***.***>; 主题: Re: [apache/seatunnel]
[Feature][Jdbc-Connector] Add OceanBase Connector (PR #4626) @whhe requested
changes on this pull request. In
seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/internal/dialect/JdbcDialectFactory.java:
> @@ -33,7 +35,7 @@ public interface JdbcDialectFactory { * @return
<code>true</code> if this dialect understands the given URL;
<code>false</code> * otherwise. */ - boolean acceptsURL(String url); I
think the driverType param shoud be passed in the create method below, and we
can use a new default method to keep the other dialects unchanged. default
JdbcDialect create(String driverType) { return create(); } In
seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/
seatunnel/connectors/seatunnel/jdbc/internal/dialect/oceanbase/OceanBaseMySqlDialectFactory.java:
> +import com.google.auto.service.AutoService; + +import
java.util.Optional; + ***@***.***(JdbcDialectFactory.class) +public class
OceanBaseMySqlDialectFactory implements JdbcDialectFactory { + @OverRide +
public boolean acceptsURL(String url, Optional<String> driverTye) { + return
url.startsWith("jdbc:oceanbase:") + && driverTye.isPresent() +
&& driverTye.get().equalsIgnoreCase("mysql"); + } + + @OverRide +
public JdbcDialect create() { + return new MysqlDialect(); We can merge the two
dialect classes of OceanBase and return the JdbcDialect by the driverType param
here. public JdbcDialect ***@***.*** String driverType) { if
("mysql".equalsIgnoreCase(driverType)) { return new MysqlDialect(); } return
new OracleDialect(); } In seatunnel-connectors-v2/connector-jdbc/pom.xml: >
@@ -129,6 +130,12 @@ <version>${vertica.version}</version>
<scope>provided</sco
pe> </dependency> + <dependency> +
<groupId>com.oceanbase</groupId> +
<artifactId>oceanbase-client</artifactId> +
<version>${oceanbase.version}</version> + <scope>provided</scope> +
</dependency> It should not be imported directly due to the lgpl license
https://github.com/oceanbase/obconnector-j In seatunnel-dist/pom.xml: > @@
-488,6 +489,12 @@ </dependency> <!-- jdbc driver --> + <dependency> +
<groupId>com.alipay.oceanbase</groupId> +
<artifactId>oceanbase-client</artifactId> +
<version>${oceanbase.version}</version> + <scope>provided</scope> +
</dependency> Should not use the previous internal version, just keep it
same with seatunnel-connectors-v2/connector-jdbc/pom.xml In
seatunnel-e2e/seatunnel-connector-v2-e2e/connector-jdbc-e2e/connector-jdbc-e2e-part-2/src/test/java/org/apache/seatunnel/connectors/seatunnel/jdbc/JdbcOceanbaseIT.java:
> +import org.junit.jupiter.api.Disabled; +import org.testconta
iners.containers.GenericContainer; +import
org.testcontainers.containers.output.Slf4jLogConsumer; +import
org.testcontainers.utility.DockerImageName; +import
org.testcontainers.utility.DockerLoggerFactory; + +import
com.google.common.collect.Lists; + +import java.util.ArrayList; +import
java.util.HashMap; +import java.util.List; +import java.util.Map; +
***@***.***("Disabled because it needs user's personal oceanbase account to run
this test!") +public class JdbcOceanbaseIT extends AbstractJdbcIT { + private
static final String OCEANBASE_IMAGE = "shihd/oceanbase:1.0"; You can use the
docker image oceanbase/oceanbase-ce:4.0.0.0 with user root and empty password.
— Reply to this email directly, view it on GitHub, or unsubscribe. You are
receiving this because you authored the thread.Message ID: ***@***.***>
Do you have time to complete this work recently? If not, we can also find
other developers in the community to continue development based on your work.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]