write db