简体   繁体   English

如何使用 JDBC 连接器连接到 Vitess 数据库

[英]How to connect to Vitess database with JDBC connector

I'm trying to connect to Vitess database.我正在尝试连接到 Vitess 数据库。
To my best knowledge I have to use dedicated JDBC connector ( https://mvnrepository.com/artifact/io.vitess/vitess-jdbc ) for the Vitess.据我所知,我必须为 Vitess 使用专用的 JDBC 连接器( https://mvnrepository.com/artifact/io.vitess/vitess-jdbc )。 I have tried to connect like this:我试过这样连接:

#1 jdbc:vitess://user:password@hostname:port/
#2 jdbc:vitess://user:password@hostname:port/my_schema
#3 jdbc:vitess://user:password@hostname:port/my_schema#replica
#4 jdbc:vitess://user:password@hostname:port/keyspace/my_schema

but I'm getting following error:但我收到以下错误:

Driver class 'io.vitess.proto.Query$ExecuteOptions$IncludedFields' not found.

I have found information regarding IncludedFields in https://vitess.io/zh/docs/reference/vitess-api/ I also tried to put this value into database url ( ?included_fields=all or ?included_fields=2 ), but apparently there is no effect at all.我在https://vitess.io/zh/docs/reference/vitess-api/中找到了有关IncludedFields的信息,我还尝试将此值放入数据库 url ( ?included_fields=all?included_fields=2 ),但显然存在完全没有效果。

Is there any way to connect to Vitess through JDBC connector?有什么方法可以通过 JDBC 连接器连接到 Vitess 吗?

Vitess can be used with mysql driver with connection string "jdbc:mysql://: Vitess 可以与带有连接字符串“jdbc:mysql://:

The Vitess JDBC driver uses grpc protocol, currently it is not managed. Vitess JDBC驱动使用grpc协议,目前不托管。

For now, we suggest to use mysql java connector.目前,我们建议使用 mysql java 连接器。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM