Connecting TCP and and DB