I have a C# console application which is using Snowflake .NET connector to connect with Snowflake DB. Application is working fine on my system however if I take that application to EC2 and execute then it's not connecting to Showflake DB with giving error "SnowflakeDbException: Request reach its timeout".
Network connectivity between AWS EC2 instance and Snowflake DB is in place.
Below is the code that I'm using:
static void Main(string[] args)
{
try
{
using (IDbConnection conn = new SnowflakeDbConnection())
{
conn.ConnectionString = "scheme=https;account=<accountname>;port=443;user=.
<xxxxxx>;password=<xxxxxx>;ROLE=<definedRole>;warehouse=<warehouse>;db=
<DBNAME>;schema=<schemaname>";
conn.Open(); //ERROR: "SnowflakeDbException: Request reach its timeout"
Console.WriteLine("Connection successful!");
using (IDbCommand cmd = conn.CreateCommand())
{
cmd.CommandText = "select * from TABLE1";
//data from an existing table
IDataReader reader = cmd.ExecuteReader();
while (reader.Read())
{
Console.WriteLine(reader.GetString(0));
}
conn.Close();
}
}
}
catch (DbException exc)
{
Console.WriteLine("Error Message: {0}", exc.Message);
}
}
If I do 'Test-NetConnection' command using powershell as below then it is succeeded.
Test-NetConnection -computerName xxxx.eu-west-1.privatelink.snowflakecomputing.com -port 443
Result: TCPTestSucceeded : True
System.Net.Http.HttpRequestException: An error occurred while sending the request. ---> System.Net.WebException: The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel. ---> System.Security.Authentication.AuthenticationException: The remote certificate is invalid according to the validation procedure.
CodePudding user response:
You are failing the CRL check. Setting the parameter INSECUREMODE=true will disable the certificate revocation list check and test should pass, but this is not recommended in a production system.