Greetings. I want to create a Linked Server on my SQL Server 12.0.5207.0 that will allow me to query an Amazon Web Services Redshift database (Postrgres 8.2) directly from SSMS. I have gotten to the point of successful connectivity testing from
the linked server to AWS, but I am not able to run any queries. Here are the steps I have taken so far.
I followed AWS's instructions; installing their 64-bit ODBC Driver on my 64-bit Windows Server 2012 R2 Datacenter and creating a System DSN via the 64-bit ODBC Administrator. (https://docs.aws.amazon.com/redshift/latest/mgmt/install-odbc-driver-windows.html).
Under "Additional Configuration" of the System DSN, "Retrieve Entire Result Into Memory" is selected by default. Under "Data Type Options" of the System DSN, "Use Unicode", Show Boolean Column as String",
and "Text as LongVarChar" are all checked by default. Also, "Max Varchar" is defaulted to '255', "Max LongVarChar" is defaulted to '8190', and "Max Bytea" is defaulted to 255.
For the MSDASQL Provider Properties, on the General Page, only the "Allow inprocess" option is checked. All other options are unchecked.
I created a Linked Server with the following configuration;
- General Page, Provider = "Microsoft OLE DB Provider for ODBC Drivers"
- General Page, Product Name = "Amazon Redshift (x64)"
- General Page, Data Source = (my System DSN from above)
- General Page, Provider String = (blank)
- General Page, Location = (blank)
- General Page, Catalog = (blank)
- Security Page, "Be made using this security context" (and my AWS login and password)
- Server Options Page, Collation Compatible = "False"
- Server Options Page, Data Access = "True"
- Server Options Page, RPC = "True"
- Server Options Page, RPC Out = "True"
- Server Options Page, Use Remote Collation = "True"
- Server Options Page, Collation Name = (blank)
- Server Options Page, Connection Timeout = "0"
- Server Options Page, Query Timeout = "0"
- Server Options Page, Distributor = "False"
- Server Options Page, Publisher = "False"
- Server Options Page, Subscriber = "False"
- Server Options Page, Lazy Schema Validation = "False"
- Server Options Page, Enable Promotion of Distributed Transactions for RPC = "True"
Testing the System DSN connection through the ODBC Administrator is successful.
Testing the Linked Server connection through the right-click context menu is successful.
I can see the Redshift database, tables, and views listed under the Linked Server in the SSMS schema browser.
When I try to execute a simple select statement on one of the views in Redshift, using the 4-part naming convention, I get the following error;
OLE DB provider "MSDASQL" for linked server "REDSHIFT" returned message "Unspecified error".
OLE DB provider "MSDASQL" for linked server "REDSHIFT" returned message "[Amazon][Support] (40470) Conversion error at column 16 and row 1: Numeric value out of range.".
Msg 7311, Level 16, State 2, Line 25
Cannot obtain the schema rowset "DBSCHEMA_COLUMNS" for OLE DB provider "MSDASQL" for linked server "REDSHIFT". The provider supports the interface, but returns a failure code when it is used.
I also tried using the right-click menus on a view to "Script view as", "Select to", "new query editor menu", and I get a similar error;
TITLE: Microsoft SQL Server Management Studio
------------------------------
Enumerate columns failed for LinkedServer 'REDSHIFT'. (Microsoft.SqlServer.Smo)
For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=13.0.15700.28+((SSMS_Rel).160810-2135)&EvtSrc=Microsoft.SqlServer.Management.Smo.ExceptionTemplates.FailedOperationExceptionText&EvtID=Enumerate+columns+LinkedServer&LinkId=20476
------------------------------
ADDITIONAL INFORMATION:
An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.ConnectionInfo)
------------------------------
Cannot obtain the schema rowset "DBSCHEMA_COLUMNS" for OLE DB provider "MSDASQL" for linked server "REDSHIFT". The provider supports the interface, but returns a failure code when it is used. (Microsoft SQL Server, Error: 7311)
For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft%20SQL%20Server&ProdVer=12.00.5207&EvtSrc=MSSQLServer&EvtID=7311&LinkId=20476
------------------------------
BUTTONS:
OK
------------------------------