class Multiwoven::Integrations::Destination::MicrosoftSql::Client

def check_connection(connection_config)

def check_connection(connection_config)
  connection_config = connection_config.with_indifferent_access
  db_client = create_connection(connection_config)
  if db_client.active?
    ConnectionStatus.new(
      status: ConnectionStatusType["succeeded"]
    ).to_multiwoven_message
  else
    ConnectionStatus.new(
      status: ConnectionStatusType["failed"], message: "MS SQL connection not active"
    ).to_multiwoven_message
  end
rescue TinyTds::Error => e
  ConnectionStatus.new(
    status: ConnectionStatusType["failed"], message: e.message
  ).to_multiwoven_message
end