2017-11-17 102 views
0

我能夠構建TDS_FDW並將擴展插入Postgresql 10.但是,我收到了一條不尋常的消息,表示失敗並顯示「成功」消息, 。TDS FDW Adaptive Server連接失敗,但消息爲「成功」

ERROR: DB-Library error: DB #: 20002, DB Msg: Adaptive Server connection failed (secsql1.secdev.local:1433), OS #: 0, OS Msg: Success, Level: 9 

SQL狀態:HV00L

的代碼生成錯誤是:

CREATE EXTENSION tds_fdw; 

-- DROP SERVER mssql_acudb_server; 
CREATE SERVER mssql_acudb_server 
    FOREIGN DATA WRAPPER tds_fdw 
    OPTIONS (servername 'wwww', port '1433', database 'AcuDB'); 

ALTER SERVER mssql_acudb_server 
    OPTIONS (ADD msg_handler 'notice'); 

-- DROP USER MAPPING FOR postgres SERVER mssql_acudb_server; 
CREATE USER MAPPING FOR postgres 
    SERVER mssql_acudb_server 
    OPTIONS (username 'xxxx\yyyy', password 'zzzz'); 

-- DROP FOREIGN TABLE acudb_project; 
CREATE FOREIGN TABLE acudb_project (
    id BIGINT NOT NULL, 
    "name" TEXT NOT NULL, 
    path_prefix TEXT NOT NULL, 
    "type" TEXT NOT NULL, 
    sec_active_size BIGINT NULL 
) 
SERVER mssql_acudb_server 
    OPTIONS (query 'SELECT [id],[name],[path_prefix],[type],[sec_active_size] 
    FROM [projects]'); 

SELECT * FROM acudb_project 

回答

0

之所以能夠通過在 「CREATE SERVER」 語句中指定freetds的版本來解決這個問題:

-- DROP SERVER mssql_acudb_server; 
CREATE SERVER mssql_acudb_server 
    FOREIGN DATA WRAPPER tds_fdw 
    OPTIONS (servername 'www', port '1433', database 'AcuDB', tds_version '7.1'); 
相關問題