SQLServer An invalid tabular data stream (TDS) collation was encountered
<p>I have got an application that inserts records to a database. This is done using a multi-threaded environment that uses database pools to retrieve the connection and then insert the records in parallel. Had not encountered such an error before when I tested my operation with a different database. When this was re-run, the error did not appear and the issue seems to be sporadic. </p>

<p>We are using Microsoft SQL Server 2012 (SP3) (KB3072779) - 11.0.6020.0 (X64) Oct 20 2015 15:36:27 Copyright (c) Microsoft Corporation Enterprise Edition (64-bit) on Windows NT 6.3  (Build 9600: ) (Hypervisor) The jdbc driver is version 4.2(sqljdbc_4.2.6420)</p>

<p>My question is what should be the course of action when such an error occurred? </p>

<p>Should I still retry using the existing connection as the data does not seem to have caused the issue?</p>

<p>P.S. I am using Retry pattern for retrying upon connection reset.</p>

<pre><code>java.util.concurrent.ExecutionException: com.microsoft.sqlserver.jdbc.SQLServerException: An invalid tabular data stream (TDS) collation was encountered.
        at com.github.rholder.retry.Retryer$ExceptionAttempt.&lt;init&gt;(Retryer.java:254)
        at com.github.rholder.retry.Retryer.call(Retryer.java:163)
        // My application code
        at db.dao.DBUtil.batch(DBUtil.java:208)
        at db.dao.DBWriter.merge(DBWriter.java:183)
        at salesforce.BulkDownloader.call(BulkDownloader.java:173)
        at salesforce.BulkDownloader.call(BulkDownloader.java:42)
        // My application code end
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at java.lang.Thread.run(Thread.java:745)
Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: An invalid tabular data stream (TDS) collation was encountered.
        at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(SQLServerException.java:217)
        at com.microsoft.sqlserver.jdbc.SQLServerStatement.getNextResult(SQLServerStatement.java:1635)
        at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.doExecutePreparedStatementBatch(SQLServerPreparedStatement.java:1426)
        at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement$PrepStmtBatchExecCmd.doExecute(SQLServerPreparedStatement.java:1336)
        at com.microsoft.sqlserver.jdbc.TDSCommand.execute(IOBuffer.java:6276)
        at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(SQLServerConnection.java:1793)
        at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeCommand(SQLServerStatement.java:184)
        at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeStatement(SQLServerStatement.java:159)
        at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.executeBatch(SQLServerPreparedStatement.java:1227)
        at org.apache.commons.dbcp2.DelegatingStatement.executeBatch(DelegatingStatement.java:345)
        at org.apache.commons.dbcp2.DelegatingStatement.executeBatch(DelegatingStatement.java:345)
        at common.RetryCallables$DatabaseBatch.call(RetryCallables.java:295)
        at common.RetryCallables$DatabaseBatch.call(RetryCallables.java:258)
        at com.github.rholder.retry.AttemptTimeLimiters$NoAttemptTimeLimit.call(AttemptTimeLimiters.java:78)
        at com.github.rholder.retry.Retryer.call(Retryer.java:160)
        ... 10 common frames omitted
</code></pre>