tds-fdw / tds_fdw

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

ERROR: DB-Library error: DB #: 20018, DB Msg: General SQL Server error: Check messages from the SQL Server, OS #: -1, OS Msg: , Level: 16 SQL state: HV00L #136

Open travisas opened 7 years ago

travisas commented 7 years ago

We recieve this error when trying to access MYSQL Link table via FDW from Postgres. Couldnt find on the web what level: 16 references. Any help would be appreciated.

Thank you Travis

juliogonzalez commented 7 years ago

Hi @travisas,

Could you share with us more details, such as tds_fdw version, freetds config, table(s) structure(s) at both MSSQL and PostgreSQL, and the query that provokes the issue?

travisas commented 7 years ago

Information Below. I have three screen captures to share. how can I do that?

Postgres version 9.6

Microsoft SQL Server 2008 (SP3) - 10.0.5538.0 (X64) Apr 3 2015 14:50:02 Copyright (c) 1988-2008 Microsoft Corporation Enterprise Edition (64-bit) on Windows NT 6.0 (Build 6002: Service Pack 2)

------------------------- Process being used

As mentioned below, If the views are pointing to different server( with linked server) we are not able to retrieve the data from SQL Server. Please find the below steps which we performed for executing the task.

  1. Connecting to Dev Server, IMASCDB.

  2. Please find the below screenshot for View Definition for [META].[MEASURE_TYPE]

  3. Please find the below screen shot for Data Types of Meta.Measure_Type

  4. We are able to create Foreign Table for the view.

  5. When we are trying to execute the query it is throwing below error.

ERROR: DB-Library error: DB #: 20018, DB Msg: General SQL Server error: Check messages from the SQL Server, OS #: -1, OS Msg: , Level: 16 SQL state: HV00L

travisas commented 7 years ago

Free TDS version: freetds-0.95.81

Global settings are overridden by those in a database

server specific section

[global]

TDS protocol version

; tds version = 4.2

    # Whether to write a TDSDUMP file for diagnostic purposes
    # (setting this to /tmp is insecure on a multi-user system)

; dump file = /tmp/freetds.log ; debug flags = 0xffff

    # Command and connection timeouts

; timeout = 10 ; connect timeout = 10

    # If you get out-of-memory errors, it may mean that your client
    # is trying to allocate a huge buffer for a TEXT field.
    # Try setting 'text size' to a more reasonable limit
    text size = 64512

A typical Sybase server

travisas commented 7 years ago

dataddl_mysql dataddl_postgres queryanderror remotelinkobject

travisas commented 7 years ago

Any help would be appreciated.. let me know if you have any questions about the uploaded images.

Postgres fdw -> mysql link table -> mysql static table

is what we are trying to do here.

ilkosta commented 7 years ago

same problem and seem same use-case:

pg (fdw) -> mssql (linked server) -> mssql

pembo13 commented 6 years ago

Seeing this when I try to update a materialized view

DB-Library error: DB #: 20004, DB Msg: Read from the server failed, OS #: 4, OS Msg: Interrupted system call, Level: 9

julqui commented 3 years ago

modificar la base de datos SQLSERVER a:

ALTER DATABASE [...]SET ANSI_NULL_DEFAULT ON
ALTER DATABASE [...]SET ANSI_NULLS ON
ALTER DATABASE [...]SET ANSI_warnings ON