未找到数据源名称且未指定默认驱动程序(使用Amazon Redshift(x64))

时间:2016-12-08 10:10:51

标签: amazon-redshift

private OdbcConnection _internalConnection;
        public OdbcConnection InternalConnection
        {
            get
            {
                if (_internalConnection == null)
                {
                    Open();
                }
                return _internalConnection;
            }
        }

        public void Open()
        {
            _internalConnection = new OdbcConnection(CreateConnectionString());

            try
            {
                if (_internalConnection.State == System.Data.ConnectionState.Closed)
                    _internalConnection.Open();
            }
            catch
            {
                throw;
            }
        }

        private string CreateConnectionString()
        {

            int endpointPort = 5439;

            string driver = "{Amazon Redshift (x64)}";
            string connectionString = "Driver={0};Server={1};Database={2};UID={3};PWD={4};Port={5};SSL=true;Sslmode=Require";

            connectionString = string.Format(connectionString,
                driver,
                Parameters[ConnectionParameterType.DataSource],
                Parameters[ConnectionParameterType.DatabaseName],
                Parameters[ConnectionParameterType.UserName],
                Parameters[ConnectionParameterType.Password],
                endpointPort);

            return connectionString;
        }

see error in image

1 个答案:

答案 0 :(得分:5)

安装32位驱动程序

https://s3.amazonaws.com/redshift-downloads/drivers/AmazonRedshiftODBC32-1.3.1.1000.msi

并用

替换字符串驱动程序

string driver =“{Amazon Redshift(x86)}”;