fixed statistics, client and server have one try-with-resources,
improvements in implementation of database