Fixed so that SQL database connects and writes.