Your workflow is unique 👨‍💻 -  tell us how you use Dropbox here.

Forum Discussion

Benne's avatar
Benne
Explorer | Level 3
7 years ago

Downloaded .sqlite "file is encrypted or is not a database"

Hello,

 

I try to download a .sqlite File from my Dropbox.

So far this works and I save it to the documents directory.

I'm also able to establish a connection to the database but when I try to execute a query I get the error message: 

"file is encrypted or is not a database"

 

this is the same database I used before as a local database in my app (I added the file manually to the project) and there it worked.

So the file can't be encrypted. 

Also the query statements stayed the same.

 

 

Do I have to add some sort of description to the file?

 

Here is my code for downloading the file:

 

  let fileManager = FileManager.default
            let directoryURL = fileManager.urls(for: .documentDirectory, in: .userDomainMask)[0]
            let destURL = directoryURL.appendingPathComponent("myTestFile.sqlite")
            let destination: (URL, HTTPURLResponse) -> URL = { temporaryURL, response in
                return destURL
            }
                client.files.download(path: path, overwrite: true, destination: destination)
                    .response { response, error in
                        if let response = response {
                            print(response)
                            
                            self.downloadFinished(url: response.1)
                            
                        } else if let error = error {
                            print(error)
                        }
                        
                     
                    }
                    .progress { progressData in
                        print(progressData)
                }
         
        }

 

3 Replies

  • Greg-DB's avatar
    Greg-DB
    Icon for Dropbox Community Moderator rankDropbox Community Moderator
    7 years ago
    Dropbox just uploads/downloads whatever data it is given, and it doesn't do anything special for .sqlite files.

    That error message isn't coming from Dropbox itself, but it seems to indicate that the data isn't what was expected.

    Can you first check the file metadata (in response.0), e.g., to see if the file size is the expected value? That should help track if it the problem is with the upload or the download.
  • Benne's avatar
    Benne
    Explorer | Level 3
    7 years ago

    Thanks for your reply.

     

    The datasize is exactly the same (920Byte)

     

     

    Is it right that when the response arrives the download is completed?

  • Greg-DB's avatar
    Greg-DB
    Icon for Dropbox Community Moderator rankDropbox Community Moderator
    7 years ago
    Yes, the download is complete when the response fires.

    If the uploaded version is correct, please check the downloaded copy directly to see if it has the expected data.

About Dropbox API Support and Feedback

Node avatar for Dropbox API Support and Feedback
Get help with the Dropbox API from fellow developers and experts.

The Dropbox Community team is active from Monday to Friday. We try to respond to you as soon as we can, usually within 2 hours.

If you need more help you can view your support options (expected response time for an email or ticket is 24 hours), or contact us on X, Facebook or Instagram.

For more info on available support options for your Dropbox plan, see this article.

If you found the answer to your question in this Community thread, please 'like' the post to say thanks and to let us know it was useful!