0

I would like to know how I can delete the local database of my Mendix programm.

The background story is that i am calling a webservice to write data to an attribute. So every time the user presses a button, the webservice writes data to the attribute. That leads to many entries with the same value. I already fixed the problem with a validation check but I can't get rid of the entries.

Does somebody know how to delete those?

2 Answers2

0

This depends on wether you run an in memory database (like HSQL) or a local database server like MS SQL Server or Postgres.

Your HSQL database will be empty on every restart, but with a local database instance it won't. Here you can use the database management tools (PostgreSQL -> PgAdmin, MSSQLSERVER -> Microsoft SQL Server Management Studio) to connect to your database. Once you've done that you will need to find your table (it will be modulename$entityname) and execute a query, e.g. TRUNCATE modulename$entityname if you want to delete all records in the table, or DELETE FROM modulename$entityname WHERE (predicate) if you want to delete specific records.

  • Alright that is a very detailed answer, thank you. I have never connected my programm to a database. Yes, the webservice pulls some data from a database but it writes it to the memory of the programm. Maybe this is a dumb question but do I need external tools to delete the local database of a Mendix application? If yes, where can I find the login data to gain access to it? – Lars Mensch Apr 23 '21 at 07:39
  • If you want to delete the entire database, then yes you need Admin tools for your local database instance. The login credentials are stored when installing the local database server. I don't know where you can retrieve them See for reference https://docs.mendix.com/developerportal/operate/restore-backup-locally#2-prerequisites – S. Bruijnis Apr 23 '21 at 18:40
  • If you only want to delete specific data from the Mendix application database, you might as well create a Microflow that retrieves these objects and then use the Delete action to delete this list (of objects). Your database will continue to exist but the data can be removed by calling this microflow (e.g. from page in the application) – S. Bruijnis Apr 23 '21 at 18:42
0

If you want to get rid of the existing entries, you can always create a microflow that does retrieves all of them from the database and deletes them. You can create an admin section with a button to run this microflow (if you only need to do this once) or create a scheduled event that runs the microflow (say every day).

MWB
  • 1,830
  • 1
  • 17
  • 38