简体   繁体   English

我需要使用 java 但不使用 spring 引导连接到 Google 云 mysql?

[英]I need to connect to Google cloud mysql using java but without using spring boot?

can someone help me with any sample working code or any project that I can look at?有人可以帮助我提供任何示例工作代码或我可以查看的任何项目吗? I have been searching this on google for few days but I always end up an answer with spring boot but I need to connect without using spring boot.我已经在谷歌上搜索了几天,但我总是以 spring 引导结束,但我需要在不使用 spring 引导的情况下进行连接。 I need to write automated API tests where I have to connect to cloud Sql fetch the data from Db and validate it.我需要编写自动化的 API 测试,我必须连接到云 Sql 从 Db 获取数据并对其进行验证。

As @siamsot mentioned, there is an article in the official GCP documentation on how to connect to a Cloud SQL instance.正如@siamsot 所提到的,GCP 官方文档中有一篇关于如何连接到 Cloud SQL 实例的文章。

Basically, you have the following options to connect to a Cloud SQL instance :基本上,您有以下选项可以连接到 Cloud SQL 实例

  • By using the proxy (Second Generation instances only)通过使用代理(仅限第二代实例)
  • By configuring access for one or more public IP addresses通过为一个或多个公共 IP 地址配置访问权限
  • By using the JDBC Socket Factory (for the Java programming language, Second Generation instances only)通过使用JDBC Socket Factory (对于 Java 编程语言,仅限第二代实例)
  • By using the Cloud SQL Proxy library (for the Go programming language, Second Generation instances only)通过使用 Cloud SQL 代理库(对于 Go 编程语言,仅限第二代实例)

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

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