简体   繁体   English

如何在JAVA中连接到MySQL和PostgreSQL的Azure数据库

[英]How to connect to the Azure database for MySQL and PostgreSQL in JAVA

发布了两个新的Azure服务, 用于MySQLPostgreSQL的 Azure数据库 ,作为一个Java开发人员,我想知道如何连接它们,常规JDBC驱动程序是否仍然有用?

MySQL and Postgres as-a-service are accessed with already-existing drivers/sdk's. 使用已有的驱动程序/ sdk访问MySQL和Postgres即服务。 Just get the connection string from the portal, and then connect. 只需从门户网站获取连接字符串,然后连接即可。

You'll see all of your connection strings in the portal, after your database instance is created: 在创建数据库实例后,您将在门户中看到所有连接字符串:

门户中的连接字符串

Yes, it works except that you have to append @ to the user name portion of the connection string. 是的,除了您必须将@附加到连接字符串的用户名部分之外,它才有效。

jdbc:postgresql:// servername .postgres.database.azure.com:5432/{your_database}?user=@ servername &password={your_password}&ssl=true jdbc:postgresql:// servername .postgres.database.azure.com:5432 / {your_database}?user = @ servername &password = {your_password}&ssl = true

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

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