Fix sql connection on getfile part. closes #2444