0
我正在构建需要连接到AWS RDS MySQL数据库的Xamarin.Mac
应用程序(C#)。如何使用证书颁发机构从C#连接到RDS MySQL数据库?
我的代码:
using (SqlConnection connection = new SqlConnection(ConnectionString))
{
connection.Open();
using (SqlCommand command = new SqlCommand("SELECT * FROM store", connection))
using (SqlDataReader reader = command.ExecuteReader())
{
while (reader.Read())
{
Console.WriteLine("{0} {1} {2}",
reader.GetInt32(0), reader.GetString(1), reader.GetString(2));
}
}
}
哪里我的连接字符串的格式为:
ConnectionString = "Server={0};Database={1}Uid={2};Pwd={3}";
不过,我似乎无法连接。然而,通过MySqlWorkbench使用相同的主机和凭据,我可以很好地连接。我看到我的RDS实例的版本设置为证书颁发机构设置为rds-ca-2015
(没有选项而不是将其设置为此)。
如何使用上面的C#代码连接到此RDS数据库?