Re-add queries to media tables so we don't break everything
Enable autocommit
Improve datasource configuration