# MemDataSource

## Overview

Servoy allows the creation of **In-Memory** tables using HSQL, which behave like regular database tables with similar configurations, including column properties and events. These tables can be populated using a *JSDataSet* and the `createDataSource()` function to dynamically define datasources or foundsets at runtime.

If the In-Memory table was predefined in Servoy Developer, there is no need to re-define column and type information during runtime.

## Creating In-Memory Databases

There are two ways to create an In-Memory database:

* Via the [Solution Explorer](https://docs.servoy.com/reference/servoy-developer/solution-explorer), under *Datasources -> In Memory -> Create new data source*. This opens a dialog to specify the datasource name and the [Table Editor](https://docs.servoy.com/reference/servoy-developer/object-editors/table-editor) for table structure definition.
* At runtime, using the [JSDataSet::createDataSource](https://docs.servoy.com/reference/servoycore/dev-api/database-manager/jsdataset#createdatasourcename) function to dynamically define datasources.

## Additional Table Event: onLoad

In-Memory tables have an extra event called **onLoad**, triggered when a form accesses the In-Memory datasource or when `datasource.mem.name.getFoundSet()` is called. This event allows on-demand population of the datasource, but you must still use `createDataSource()` in the **onLoad** method to populate the table.

## Commands Summary

* ***Create in memory datasource*** - Opens the [Table Editor](https://docs.servoy.com/reference/servoy-developer/object-editors/table-editor).
* ***Edit table/view*** - Edits table structure via the [Table Editor](https://docs.servoy.com/reference/servoy-developer/object-editors/table-editor).
* ***Delete In Memory Datasource*** - Deletes the datasource definition.
* ***Rename In Memory Datasource*** - Renames the datasource definition.
* ***Search for references*** - Finds locations within the solution where the datasource is used.

For more details, please refer to the [In-memory Databases](https://docs.servoy.com/guides/develop/application-design/data-modeling/in-memory-databases) section of the **Data modeling** documentation.

***


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.servoy.com/reference/servoycore/dev-api/datasources/memdatasource.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
