How To Solve: Error in the TDS datastream with i-net MERLIA driver connecting to Azure SQL database

This week I have spent hours together with one of our ISV partners to get a strange connection error to the Azure SQL Database resolved.


Our partner has an Java application that uses the i-net MERLIA driver for connecting to the Azure SQL Database Server. The error was not very helpful to solve the problem. Also strange was that their solution was able to connect to the Azure SQL Database from their on-prem environment. But in Azure it has not worked, we have tried on Debian (Jessie) and Ubuntu (16.04. LTS).


 com.inet.tds.Tds4SQLException: Error in the TDS datastream: data(1) greater than block(-308/0)
        at com.inet.tds.ab.a( ~[merlia-8.07.jar:na]
        at com.inet.tds.ap.g( ~[merlia-8.07.jar:na]
        at com.inet.tds.ap.j( ~[merlia-8.07.jar:na]
        at com.inet.tds.ap.b( ~[merlia-8.07.jar:na]
        at com.inet.tds.ap.a( ~[merlia-8.07.jar:na]
        at com.inet.tds.ap.<init>( ~[merlia-8.07.jar:na]
        at com.inet.tds.z.<init>( ~[merlia-8.07.jar:na]
        at com.inet.tds.ab.a( ~[merlia-8.07.jar:na]
        at com.inet.tds.TdsDriver.connect( ~[merlia-8.07.jar:na]
        at com.inet.tds.TdsDataSource.getConnection( ~[merlia-8.07.jar:na]
        at com.inet.tds.PDataSource.getPooledConnection( ~[merlia-8.07.jar:na]


Many hours later the solution was quite easy. There seems to be a bug in the driver version 8.07, which is already resolved in version 8.0840:



Datenbanktreiber für MS SQL in der Cloud (Azure): Error in the TDS datastream


In our case we changed back to an older driver (version 6.04) as we had no immediate to newest version. After changing the driver version the issue was gone.


Unfortunately, we spent some time because Google or Bing did not show us the helpdesk page. Hopefully this blog post will help some people to find it better. Btw, finally we found it via the website search by i-net. So one learning for the next time is to search directly on the site (e.g. merlia azure