Reputation:
I want to connect my google cloud SQL Server with SSL in c#. But I'm getting a Argument Exception error for "driver, sslca, sslcert and sslkey" keywords.
How can I connect my database to use SSL?
string connStr = "Driver={MySQL ODBC 5.2 ANSI Driver}; Server=35.148.120.30; User = myuser; Password = mypass; sslca = ../sql_pem/server-ca.pem; sslcert = ../sql_pem/client-cert.pem; sslkey = ../sql_pem/client-key.pem; sslverify = 1; Option = 3; ";
MySqlConnection conn = new MySqlConnection(connStr);
MySqlCommand cmd;
string s0;
try
{
conn.Open();
s0 = "CREATE DATABASE IF NOT EXISTS `hello97`;";
cmd = new MySqlCommand(s0, conn);
cmd.ExecuteNonQuery();
conn.Close();
}
catch (Exception es)
{
}
Error
An unhandled exception of type 'System.ArgumentException' occurred in System.Data.dll
Additional information: Keyword not supported.
Upvotes: 0
Views: 888
Reputation: 28207
Assuming you're using Connector/NET, the valid connection string options are listed here:
CACertificateFile
CertificateFile
option.Upvotes: 1