So the query works consistently in DB2? It seems that either
DB2 is having issues or you have s network timeout issue.