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.

Problem

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(Tds4Factory.java:184) ~[merlia-8.07.jar:na]
        at com.inet.tds.ap.g(TdsConnection.java:3568) ~[merlia-8.07.jar:na]
        at com.inet.tds.ap.j(TdsConnection.java:3022) ~[merlia-8.07.jar:na]
        at com.inet.tds.ap.b(TdsConnection.java:2816) ~[merlia-8.07.jar:na]
        at com.inet.tds.ap.a(TdsConnection.java:2297) ~[merlia-8.07.jar:na]
        at com.inet.tds.ap.<init>(TdsConnection.java:211) ~[merlia-8.07.jar:na]
        at com.inet.tds.z.<init>(Tds4Connection.java:41) ~[merlia-8.07.jar:na]
        at com.inet.tds.ab.a(Tds4Factory.java:38) ~[merlia-8.07.jar:na]
        at com.inet.tds.TdsDriver.connect(TdsDriver.java:80) ~[merlia-8.07.jar:na]
        at com.inet.tds.TdsDataSource.getConnection(TdsDataSource.java:55) ~[merlia-8.07.jar:na]
        at com.inet.tds.PDataSource.getPooledConnection(PDataSource.java:42) ~[merlia-8.07.jar:na]

Solution

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:

 

Bugfixes

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 site:www.inetsoftware.de).