Acessing the database

Hi. I'm fairly new to mendix, I've just finished the pizza Mario demo case, and i have some questions regarding database access. 1- When i use a microflow, i can choose whether to fetch data from an association or from the database. How are these two methods of access different? 2- Is there a way to have mendix access data from a different database other than it's own? For example, is there a way to have mendix create it's domain model on an already existing SQL server instance?
1 answers

Hi Ricardo, Here is some answers to your questions which i hope will help you out.

  1. The difference between the two is that a retrieve from association will retrieve objects from memory that are associated to an object. You may not want to commit objects to the database and therefore this is why there is a retrieve from association. With the retrieve from database you can also create an xpath to filter what you want to retrieve. For instance you may only want to retrieve objects that have a certain attribute set.

  2. Yes it is possible to have your mendix domain model on another server. If you click on your projects settings and then double click on one of your configurations from the list or press the new button. You will then be able to enter the connection details for your SQL server.

As Bas has mentioned you can't just point the Mendix application at an existing SQL database and get it to create your domain model. What you can do is use existing webservices to import and create part of your domain model for you.

If you want to simply import some data into your mendix application from another database you can use the database replication module from the appstore.

I hope this helps. If you need more information take a look in the documentation section or just ask here.