简体   繁体   English

如何从我的微服务连接 azure postgres

[英]How to connect azure postgres from my microservice

I have a microservice to read data from json and to save in local postgres but now i want to use azure postgres instead of local DB.我有一个微服务可以从 json 读取数据并保存在本地 postgres 中,但现在我想使用 azure postgres 而不是本地 DB。 When i try to connect using application properties im getting timeout error.当我尝试使用应用程序属性进行连接时,出现超时错误。 Is there anything im missing?我有什么遗漏吗?

In my connection security i have enabled Allow access to Azure services, i have also added my ip address in firewall rule and my SSl setting is disabled.在我的连接安全性中,我启用了允许访问 Azure 服务,我还在防火墙规则中添加了我的 ip 地址,并且我的 SSl 设置被禁用。

My application properties file for local postgres, which is working fine我的本地 postgres 应用程序属性文件,工作正常

spring.datasource.url=jdbc:postgresql://localhost:5432/MyDB
spring.datasource.username=postgres
spring.datasource.password=1234
spring.datasource.driver-class-name=org.postgresql.Driver
spring.datasource.platform=postgres

My application properties for azure postgres which is not working我的 azure postgres 的应用程序属性不起作用

spring.datasource.url : myapp.postgres.database.azure.com/test
spring.datasource.username: adminmyapp@myapp
spring.datasource.password: 123456
spring.datasource.driver-class-name=org.postgresql.Driver
spring.datasource.platform=postgres

Is my application properties correct?我的应用程序属性是否正确?

I think you need to mention the driver as well,我认为您还需要提及驱动程序,

spring.datasource.url=jdbc:postgresql://myapp.postgres.database.azure.com:5432/MyDB

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

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