tds-fdw / tds_fdw

A PostgreSQL foreign data wrapper to connect to TDS databases (Sybase and Microsoft SQL Server)
Other
360 stars 99 forks source link

Error: DB-Library error: DB #: 18488, DB Msg: General SQL Server error: Check messages from the SQL Server, OS #: -1, OS Msg: , Level: 14 #133

Open martinamuscariello opened 7 years ago

martinamuscariello commented 7 years ago

I try to set up a sql server connection through tds_fdw I execute the following code

CREATE EXTENSION tds_fdw

CREATE SERVER box_svr FOREIGN DATA WRAPPER tds_fdw OPTIONS (servername 'myserver', msg_handler 'notice');

CREATE USER MAPPING FOR postgres SERVER box_svr OPTIONS (username 'postgres_user', password 'my_pwd');

CREATE FOREIGN TABLE dbo.azioni ( id_azione integer, descrizione_azione character varying ) SERVER box_svr OPTIONS (query 'SELECT * FROM dbo.Azioni');

But when I try to select from foreign table , I get the following error message:

select * from dbo.azioni

ErrorCode: -2147467259 Severity: ERRORE, Code: HV00L, Line: 3860, Position: ErrorMessage: DB-Library error: DB #: 18488, DB Msg: General SQL Server error: Check messages from the SQL Server, OS #: -1, OS Msg: , Level: 14

Could you help me to understand what I'm doing wrong? Thanks in advance.

devendra857 commented 7 years ago

give permission to the user who is using the foreign server -- pg_authid and pg_user_mapping

grant all on pg_authid to user; grant all on pg_user_mapping to user; i.e user= postgres_user

devendra857 commented 7 years ago

124

martinamuscariello commented 7 years ago

I've already given permissions to the user on the foreign server.
I add 'tds_version' option to foreign server, but I still have the same problem.