How are you concluding that the data is not being written ? Are you sure you are looking at the right location for the file ? HAve you tried using a hardcoded absolute path for example ?