ex17.c now writes DB