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數據庫?