How to Retrieve Mendix File Documents Stored in MSSQL Without Using Mendix

0
Hi,We have a Mendix application where documents and other records are stored in an MSSQL database. We need to migrate all data, including uploaded documents, to another application that will not use Mendix.Can anyone guide us on:How Mendix stores FileDocument data in MSSQL?How to retrieve document files along with their associated business records?What is the best approach to migrate these documents to another database without using the Mendix Runtime?Any documentation or sample SQL queries would be very helpful.Thanks!
asked
1 answers
0

Hi Pankaj,

Yes, it is possible to migrate the documents without using Mendix Runtime, but I would not recommend directly reading the Mendix database tables and extracting the binary data unless you fully understand the database structure.


A System.FileDocument is the Mendix system entity used for storing files, and its file content is binary data. Mendix also supports binary attributes directly in the database, although for most file scenarios Mendix recommends using a FileDocument association.


For a migration, I would suggest this approach:

  1. Identify the business entity → FileDocument association in your domain model.
  2. Retrieve the corresponding FileDocument records, including metadata such as:
    • File name
    • MIME type
    • Size
    • Creation date
    • Object ID
  3. Extract the actual binary content.
  4. Store the binary files in the target application's file storage.
  5. Keep the original Mendix object ID/association information as a migration reference so you can map the documents back to the correct business records.


If you still have access to the Mendix application, a safer migration approach is to expose/retrieve the files through Mendix rather than querying the internal database directly. Mendix supports retrieving FileDocument content through REST and storing the binary response as a file.


Also, depending on the deployment architecture, don't assume that the document binary is necessarily stored in the MSSQL database. For example, current Mendix environments can use separate blob/file storage for System.FileDocument contents.


So before writing SQL queries, Expose as REST API and Use in Non Mendix Application.


Kindly mark this as the accepted answer if it helps.


answered