Dear Concern,
We are trying to connect SQL Server from PostgreSQL through odbc_fdw extension.
We are using PostgreSQL version 15 and enclosed installed extension is attached. First, we create the foreign server.
Then we map the postgres user and created foreign table as per the requirement by following code:
CREATE EXTENSION odbc_fdw;
CREATE SERVER sql_server_odbc
FOREIGN DATA WRAPPER odbc_fdw
OPTIONS (dsn 'SqlConnect');
CREATE FOREIGN TABLE USER_LOCATION_PERMISSION_ODBC (
id bigint NOT NULL,
locationsfilter_id bigint NOT NULL,
user_id bigint NOT NULL
)
SERVER sql_server_odbc
OPTIONS (schema_name 'dbo', table_name 'USER_LOCATION_PERMISSION');
CREATE USER MAPPING FOR postgres
SERVER sql_server_odbc
But while executing below statement,
SELECT * FROM USER_LOCATION_PERMISSION_ODBC
We will get the following error:
ERROR: Connecting to driver SQL state: 58000
Please suggest me why this error was occurred.
Regards,
Soumya Ghosh