1
0
mirror of https://github.com/Bayselonarrend/OpenIntegrations.git synced 2025-04-25 12:24:39 +02:00
OpenIntegrations/docs/en/md/PostgreSQL/Common-methods/Generate-connection-string.mdx
Vitaly the Alpaca (bot) e5f231d725 Main build (Jenkins)
2025-02-18 14:08:09 +03:00

68 lines
1.7 KiB
Plaintext
Vendored

---
sidebar_position: 5
---
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
# Generate connection string
Forms a connection string from the passed data
`Function GenerateConnectionString(Val Address, Val Base, Val Login, Val Password = "", Val Port = "5432") Export`
| Parameter | CLI option | Type | Required | Description |
|-|-|-|-|-|
| Address | --addr | String | ✔ | IP address or domain name of the server |
| Base | --db | String | ✔ | Name of the database to connect |
| Login | --login | String | ✔ | Postgres user login |
| Password | --pass | String | ✖ | Postgres user password |
| Port | --port | String | ✖ | Connection port |
Returns: String - PostgreSQL database connection string
<br/>
```bsl title="1C:Enterprise/OneScript code example"
Address = "127.0.0.1";
Login = "bayselonarrend";
Password = "12we...";
Base = "postgres";
Result = OPI_PostgreSQL.GenerateConnectionString(Address, Base, Login, Password);
```
<Tabs>
<TabItem value="bash" label="Bash" default>
```bash
oint postgres GenerateConnectionString \
--addr "127.0.0.1" \
--db "postgres" \
--login "bayselonarrend" \
--pass "***"
```
</TabItem>
<TabItem value="bat" label="CMD/Bat" default>
```batch
oint postgres GenerateConnectionString ^
--addr "127.0.0.1" ^
--db "postgres" ^
--login "bayselonarrend" ^
--pass "***"
```
</TabItem>
</Tabs>
```json title="Result"
"postgresql://bayselonarrend:***@127.0.0.1:5432/postgres"
```