2025-03-27 20:05:59 +03:00
---
sidebar_position: 5
2025-05-05 11:15:20 +03:00
description: Generate connection string and other functions to work with MySQL in the Open Integration Package, a free open-source integration library for 1C:Enterprise 8, OneScript and CLI
2025-05-05 09:49:19 +03:00
keywords: [1C, 1С, 1С:Enterprise, 1С:Enterprise 8.3, API, Integration, Services, Exchange, OneScript, CLI, MySQL]
2025-03-27 20:05:59 +03:00
---
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
# Generate connection string
Forms a connection string from the passed data
2025-04-03 22:56:38 +03:00
`Function GenerateConnectionString(Val Address, Val Base = "", Val Login = "", Val Password = "", Val Port = "3306") Export`
2025-03-27 20:05:59 +03:00
| Parameter | CLI option | Type | Required | Description |
|-|-|-|-|-|
| Address | --addr | String | ✔ | IP address or domain name of the server |
2025-04-03 22:56:38 +03:00
| Base | --db | String | ✖ | Name of the database to connect |
| Login | --login | String | ✖ | MySQL user |
2025-03-27 20:05:59 +03:00
| Password | --pass | String | ✖ | MySQL password |
| Port | --port | String | ✖ | Connection port |
Returns: String - MySQL database connection string
<br/>
```bsl title="1C:Enterprise/OneScript code example"
2025-06-29 14:35:33 +03:00
Address = "127.0.0.1";
2025-03-27 20:05:59 +03:00
Login = "bayselonarrend";
2025-06-29 14:35:33 +03:00
Password = "12we...";
2025-03-27 20:05:59 +03:00
Base = "";
Result = OPI_MySQL.GenerateConnectionString(Address, Base, Login, Password);
```
2025-04-06 17:14:16 +03:00
<Tabs>
<TabItem value="bash" label="Bash" default>
```bash
oint mysql GenerateConnectionString \
--addr "127.0.0.1" \
2025-10-07 19:27:04 +03:00
--login "bayselonarrend" \
2025-09-16 09:07:33 +03:00
--pass "***" \
2025-10-07 19:27:04 +03:00
--port 3307
2025-04-06 17:14:16 +03:00
```
</TabItem>
<TabItem value="bat" label="CMD/Bat" default>
```batch
oint mysql GenerateConnectionString ^
--addr "127.0.0.1" ^
2025-10-07 19:27:04 +03:00
--login "bayselonarrend" ^
2025-09-16 09:07:33 +03:00
--pass "***" ^
2025-10-07 19:27:04 +03:00
--port 3307
2025-04-06 17:14:16 +03:00
```
</TabItem>
</Tabs>
```json title="Result"
"mysql://bayselonarrend:***@127.0.0.1:3306/"
```