This commit is contained in:
Vinay Gera 2024-03-07 13:48:18 -08:00
Родитель f57665829a
Коммит d96249cfcb
2 изменённых файлов: 3 добавлений и 3 удалений

Просмотреть файл

@ -33,9 +33,9 @@ Connect to Azure Database for MySQL from your applications using the open-source
Connect to Azure Database for MySQL using JDBC and select all records in the sales table. You can get the JDBC connection string for the database from the Azure Portal.
```java
String url = String.format("jdbc:mysql://fabrikamysql.mysql.database.azure.com:3306/fabrikamdb?verifyServerCertificate=true&useSSL=true&requireSSL=false");
String url = String.format("jdbc:mysql://[your-database-hostname].mysql.database.azure.com:3306/[your-database-name]?verifyServerCertificate=true&useSSL=true&requireSSL=[true|false]&user=[your-username]&password=[your-password]");
try {
Connection conn = DriverManager.getConnection(url, "frank@fabrikamysql", "aBcDeFgHiJkL");
Connection conn = DriverManager.getConnection(url, "USERNAME", "PASSWORD");
String selectSql = "SELECT * FROM SALES";
Statement statement = conn.createStatement();
ResultSet resultSet = statement.executeQuery(selectSql);

Просмотреть файл

@ -33,7 +33,7 @@ Connect to Azure Database for PostgreSQL from your applications using the open-s
Connect to Azure Database for PostgreSQL using JDBC and select all records in the sales table. You can get the JDBC connection string for the database from the Azure Portal.
```java
String url = String.format("jdbc:postgresql://mypostgresdb.postgres.database.azure.com:5432/mydb?user=frank@mypostgresdb&password=AbCdEfGhIjK&ssl=true");
String url = String.format("jdbc:postgresql://[your-database-hostname].postgres.database.azure.com:5432/[your-database-name]?user=[your-username]@[your-database-hostname]&password=[your-password]&ssl=true");
Connection connection = null;
try {
connection = DriverManager.getConnection(url);