我有一个将记录插入数据库的应用程序。这是使用多线程环境完成的,该环境使用数据库池来检索连接,然后并行插入记录。在我用不同的数据库测试我的操作之前没有遇到过这样的错误。当重新运行时,错误没有出现,问题似乎是零星的。
我们正在使用Microsoft SQL Server 2012(SP3)(KB3072779) - 11.0.6020.0(X64)2015年10月20日15:36:27版权所有(c)Microsoft Corporation企业版(64位)在Windows NT 6.3上9600:)(管理程序)jdbc驱动程序是版本4.2(sqljdbc_4.2.6420)
我的问题是发生此类错误时的行动方式应该是什么?
我是否仍然可以使用现有连接重试,因为数据似乎没有导致问题?
P.S。我正在使用重试模式在重置连接时重试。
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.<init>(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