---
sidebar_position: 5
description: Generate connection string and other functions to work with PostgreSQL in the Open Integration Package, a free open-source integration library for 1C:Enterprise 8, OneScript and CLI
keywords: [1C, 1С, 1С:Enterprise, 1С:Enterprise 8.3, API, Integration, Services, Exchange, OneScript, CLI, PostgreSQL]
---

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 | &#x2714; | IP address or domain name of the server |
  | Base | --db | String | &#x2714; | Name of the database to connect |
  | Login | --login | String | &#x2714; | Postgres user login |
  | Password | --pass | String | &#x2716; | Postgres user password |
  | Port | --port | String | &#x2716; | Connection port |

  
  Returns:  String - PostgreSQL database connection string



```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 "***" \
             --port 5433
        ```
    </TabItem>
  
    <TabItem value="bat" label="CMD/Bat" default>
        ```batch
            oint postgres GenerateConnectionString ^
             --addr "127.0.0.1" ^
             --db "postgres" ^
             --login "bayselonarrend" ^
             --pass "***" ^
             --port 5433
        ```
    </TabItem>
</Tabs>


```json title="Result"
"postgresql://bayselonarrend:***@127.0.0.1:5432/postgres"
```
