Connection Settings
The DB_Sqlite sample runs on a single SQLite connection named local. Connection information is stored in
XDatabase\connections.json in the project folder and edited on the Database → Database Connections screen of the Solution Explorer.
When a project opens, this file is read and the connections are registered before the scripts are built. That is why scripts (Data.xms etc.)
can reach the connection with a single line: DB["local"]. Registration does not open the connection; scripts open it by calling Open().
Note The project file (
.xmp) also has aDatabaseOptionblock, but it is a copy written when the project is saved.connections.jsonis what is used when the project opens, so change connections on the Database Connections screen or inconnections.json.
Database Connections Screen

| Item | Description |
|---|---|
| Connection card | Shows name · type (sqlite / mssql) · path or server · description. The dot on the left is green while the connection is open and gray when closed |
| Card context menu | Open · Close · Test Connection · Remove. The test here uses the values applied to the card |
| Selected Connection | Details of the selected connection — Name · Type and, for sqlite, Path; for mssql, Server · Database · User · Password · Conn Timeout (s) · Cmd Timeout (s) · Ping Interval (s) · Reconnect; and Description |
| Apply · Test Connection | Applies the entered details to the card / tests the connection with the values being entered |
| Backup Folder · Auto Backup · hours · Keep Last | Backup folder · automatic backup on/off and interval in hours · number to keep. In the current version these values are only saved; automatic backup does not run (Chapter 9) |
| Journal Mode | SQLite journal mode : WAL (default) or DELETE |
| Add · Remove | Creates a new SQLite connection (db1, db2 …) / removes the selected connection from the list after confirmation |
| Open Database Studio | Saves the current contents and opens Database Studio |
| SAVE | Saves all settings and registers the DB connections again (connections that were open are closed). Details not yet applied with [Apply] are included, and if a SQLite path was changed, you are asked what to do with the existing DB file (Move · Copy · Leave · Cancel) |
| RELOAD | Reads the file again after confirmation (unsaved changes are discarded) |
The Sample's Actual Settings
This is XDatabase\connections.json of DB_Sqlite.
{
"Connections": [
{
"Name": "local",
"Type": "sqlite",
"Path": "XDatabase/LocalDB.db",
"Server": "",
"Database": "",
"User": "",
"PasswordEnc": "",
"ConnectionTimeout": 15,
"CommandTimeout": 30,
"PingIntervalSec": 10,
"ReconnectRetries": 3,
"Description": "테스트용 db"
}
],
"BackupFolder": "XDatabase/",
"AutoBackupEnabled": false,
"AutoBackupIntervalHours": 24,
"BackupKeepLast": 30,
"JournalMode": "WAL"
}Field Reference
Connection (an item of the Connections array)
| Key | Value / Meaning |
|---|---|
| Name | "local" — the name scripts use as DB["local"] |
| Type | "sqlite" or "mssql" |
| Path | SQLite file path. A relative path is based on the project folder; if empty, XDatabase\ConnectionName.db is used |
| Server · Database · User | MSSQL only. If User is empty, Windows integrated security is used |
| PasswordEnc | The encrypted MSSQL password. Enter the password in the Password box on the screen |
| ConnectionTimeout | MSSQL connection timeout (seconds). Default 15 |
| CommandTimeout · PingIntervalSec · ReconnectRetries | MSSQL command timeout · disconnection check interval · number of automatic reconnects. In the current version they are only saved and not applied to the connection (always 30 s · 10 s · 3 times) |
| Description | Description. Shown on the card; no effect on behavior |
A SQLite connection uses only Name · Type · Path; the timeout and reconnect values apply to MSSQL only.
Caution Passwords are encrypted with Windows DPAPI (current user). When the project is moved to another PC or Windows account, decryption fails and the password becomes empty, so enter the password again on the deployed machine and save.
Options (outside the Connections array)
| Key | Meaning |
|---|---|
| BackupFolder | Backup folder (default XDatabase/Backup; the sample uses XDatabase/). Only saved in the current version |
| AutoBackupEnabled · AutoBackupIntervalHours · BackupKeepLast | Automatic backup on/off · interval (hours, default 24) · number to keep (default 30). In the current version the values are only saved; automatic backup does not run |
| JournalMode | SQLite journal mode. With "WAL" (default) the connection is set to WAL mode when it opens. The other choice is "DELETE" (Chapter 9) |
Run backups yourself with [Backup...] in Database Studio or with Backup() · StartBackupThread() in scripts (Chapter 9).
SQLite and MSSQL
| Item | SQLite | MSSQL |
|---|---|---|
Type | "sqlite" | "mssql" |
| Required values | Path (if empty, XDatabase\ConnectionName.db) | Server · Database (and Password when User is set) |
| Parameter placeholder | ? | ? (converted to @p0, @p1 … internally) |
Backup (Backup · StartBackupThread) | Supported | Not supported — fails, and OnBackupDone is called with failure |
| Disconnection detection | — | The connection is checked periodically; OnRemoteDbDisconnected when lost and OnRemoteDbReconnected after automatic reconnection |
The same script code (DB[...].RunSqlSelect(...) and so on) works on both databases. The SQL statements themselves follow each database's syntax.
Two Ways to Register a New Connection
A. Database Connections Screen (recommended)
Solution Explorer
├── Data Editor Pages
└── Database ← top-level group, peer of Data Editor Pages
├── Database Connections ← this chapter
├── Database Studio (Chapters 3 · 4)
└── Database Events (Chapter 8)- Press [Add] to create a new SQLite connection card with a name such as
db1. - In Selected Connection on the right, enter Name · Type · Path (for MSSQL, Server · Database · User · Password) · Description and press [Apply].
- Test the connection with [Test Connection].
- Press [SAVE];
connections.jsonis saved and the connections are registered again, so scripts can useDB["name"].
B. Editing connections.json Directly
You can also open XDatabase\connections.json in a text editor and add an object to the Connections array. The change takes effect after you reopen the project,
or after you read the file again with RELOAD on the Database Connections screen and press [SAVE]. The MSSQL password is stored encrypted,
so it cannot be written into the file directly; enter it in the Password box on the screen.
Next Chapter
Once the connection is in place, the next step is creating the table. The sample uses a single table, order_history, for every demonstration.