[GH-ISSUE #1148] How to change default h2 database to postgresql? #244

Closed
opened 2026-03-07 20:46:48 +03:00 by kerem · 8 comments
Owner

Originally created by @miltonchirinos44 on GitHub (Sep 13, 2022).
Original GitHub issue: https://github.com/dbeaver/cloudbeaver/issues/1148

Hello friends, a question:
How can I change the default database h2 Database Engine to postgresql database in cloudbeaver

Originally created by @miltonchirinos44 on GitHub (Sep 13, 2022). Original GitHub issue: https://github.com/dbeaver/cloudbeaver/issues/1148 Hello friends, a question: How can I change the default database h2 Database Engine to postgresql database in cloudbeaver
kerem 2026-03-07 20:46:48 +03:00
Author
Owner

@kseniaguzeeva commented on GitHub (Sep 14, 2022):

The way to change the database is described in this article.

<!-- gh-comment-id:1246740687 --> @kseniaguzeeva commented on GitHub (Sep 14, 2022): The way to change the database is described in [this article](https://github.com/dbeaver/cloudbeaver/wiki/Server-configuration#database-configuration).
Author
Owner

@kseniaguzeeva commented on GitHub (Sep 15, 2022):

I'm sorry, the link was wrong. Here is the correct one https://github.com/dbeaver/cloudbeaver/wiki/Server-configuration#database-configuration.

<!-- gh-comment-id:1248032348 --> @kseniaguzeeva commented on GitHub (Sep 15, 2022): I'm sorry, the link was wrong. Here is the correct one https://github.com/dbeaver/cloudbeaver/wiki/Server-configuration#database-configuration.
Author
Owner

@miltonchirinos44 commented on GitHub (Sep 15, 2022):

@kseniaguzeeva,
Can you help me verifying the new configuration that I want to make from h2 to postgresql as indicated in the image, can you tell me if it is ok or not?
verificar configuracion
Is it necessary to add the username and password?

attached files
NEW POSTGRESQL DATABASE CONFIGURATION.txt
CURRENT H2 DATABASE CONFIGURATION.txt

<!-- gh-comment-id:1248627947 --> @miltonchirinos44 commented on GitHub (Sep 15, 2022): @kseniaguzeeva, Can you help me verifying the new configuration that I want to make from h2 to postgresql as indicated in the image, can you tell me if it is ok or not? ![verificar configuracion](https://user-images.githubusercontent.com/52106718/190508213-ed0426db-5c8b-4106-bf23-117b340f61d3.png) Is it necessary to add the username and password? attached files [NEW POSTGRESQL DATABASE CONFIGURATION.txt](https://github.com/dbeaver/cloudbeaver/files/9579045/NEW.POSTGRESQL.DATABASE.CONFIGURATION.txt) [CURRENT H2 DATABASE CONFIGURATION.txt](https://github.com/dbeaver/cloudbeaver/files/9579046/CURRENT.H2.DATABASE.CONFIGURATION.txt)
Author
Owner

@kseniaguzeeva commented on GitHub (Sep 16, 2022):

Here you can see the config example:
{ "server": { "serverName": "test", "serverURL": "http://localhost:8978", "expireSessionAfterPeriod": 1800000, "database": { "driver": "postgres-jdbc", "url": "jdbc:postgresql://your_local_host/cb", "user": "user_name", "password": "user_password" } } }

The command example to run the instance is
docker run --name docker_name --rm -ti -p 8978:8978 --add-host=host.docker.internal:your_local_host -v way_to_local_configuration:/opt/cloudbeaver/workspace dbeaver/cloudbeaver:cloudbeaver_version

<!-- gh-comment-id:1249467405 --> @kseniaguzeeva commented on GitHub (Sep 16, 2022): Here you can see the config example: `{ "server": { "serverName": "test", "serverURL": "http://localhost:8978", "expireSessionAfterPeriod": 1800000, "database": { "driver": "postgres-jdbc", "url": "jdbc:postgresql://your_local_host/cb", "user": "user_name", "password": "user_password" } } } ` The command example to run the instance is `docker run --name docker_name --rm -ti -p 8978:8978 --add-host=host.docker.internal:your_local_host -v way_to_local_configuration:/opt/cloudbeaver/workspace dbeaver/cloudbeaver:cloudbeaver_version `
Author
Owner

@miltonchirinos44 commented on GitHub (Sep 16, 2022):

@kseniaguzeeva
thanks for the example but my idea was to modify the base from the backend side and not by a command.

Me podria indicar cual es la carpeta donde debo modificar?

How can I modify the default h2 database to postgresql through the backend?

<!-- gh-comment-id:1249543987 --> @miltonchirinos44 commented on GitHub (Sep 16, 2022): @kseniaguzeeva thanks for the example but my idea was to modify the base from the backend side and not by a command. Me podria indicar cual es la carpeta donde debo modificar? How can I modify the default h2 database to postgresql through the backend?
Author
Owner

@miltonchirinos44 commented on GitHub (Sep 19, 2022):

@kseniiaguzeeva , I tell you that I managed to change the configuration of the default database H2 that is by default to postgresql. I do this in the build files that are in the deploy, I understand that the files that are in the deploy are generated using the command

cd cloudbeaver/deploy
./build.sh

@kseniiaguzeeva Could you please tell me in which part of the source code I have to add or modify this configuration, so that it is configured permanently, since as I make the configuration in the configuration files, the configuration will surely be restored once I execute the command ./build.sh

FILE CONFIGURATION DEPLOY cloudbeaver.conf

file path: cloudbeaver/deploy/cloudbeaver/conf/cloudbeaver.conf

{
    server: {
        serverPort: 8978,

        workspaceLocation: "workspace",
        contentRoot: "web",
        driversLocation: "drivers",

        rootURI: "/",
        serviceURI: "/api/",

        productConfiguration: "conf/product.conf",

        expireSessionAfterPeriod: 1800000,

        develMode: false,

        enableSecurityManager: false,

        database: {
            driver="postgres-jdbc",
            url: "jdbc:postgresql://localhost:5432/postgres-milton",
            user: "postgres",
            password: "postgres",

            createDatabase: true,

            initialDataConfiguration: "conf/initial-data.conf",

            pool: {
                minIdleConnections: 4,
                maxIdleConnections: 10,
                maxConnections: 100,
                validationQuery: "SELECT 1"
            }
        }

    },
    app: {
        anonymousAccessEnabled: true,
        anonymousUserRole: "user",
        supportsCustomConnections: false,

        forwardProxy: false,

        publicCredentialsSaveEnabled: true,
        adminCredentialsSaveEnabled: true,

        resourceManagerEnabled: true,

        resourceQuotas: {
            dataExportFileSizeLimit: 10000000,
            resourceManagerFileSizeLimit: 500000,
            sqlMaxRunningQueries: 100,
            sqlResultSetRowsLimit: 100000,
            sqlResultSetMemoryLimit: 2000000,
            sqlTextPreviewMaxLength: 4096,
            sqlBinaryPreviewMaxLength: 261120
        },
        enabledAuthProviders: [
            "local"
        ],

        disabledDrivers: [
            "sqlite:sqlite_jdbc",
            "h2:h2_embedded",
            "clickhouse:yandex_clickhouse"
        ]

    }

}

image

run cloudbeaver project in eclipse "RUN -> RUN CONFIGURATIONS -> CloudbeaverServer.product -> RUN "
image

Console:
image

automatic table creation
image

image

<!-- gh-comment-id:1251232083 --> @miltonchirinos44 commented on GitHub (Sep 19, 2022): @kseniiaguzeeva , I tell you that I managed to change the configuration of the default database H2 that is by default to postgresql. I do this in the build files that are in the `deploy`, I understand that the files that are in the `deploy` are generated using the command ``` cd cloudbeaver/deploy ./build.sh ``` @kseniiaguzeeva Could you please tell me in which part of the source code I have to add or modify this configuration, so that it is configured permanently, since as I make the configuration in the configuration files, the configuration will surely be restored once I execute the command ` ./build.sh` FILE CONFIGURATION DEPLOY `cloudbeaver.conf` file path: `cloudbeaver/deploy/cloudbeaver/conf/cloudbeaver.conf` ``` { server: { serverPort: 8978, workspaceLocation: "workspace", contentRoot: "web", driversLocation: "drivers", rootURI: "/", serviceURI: "/api/", productConfiguration: "conf/product.conf", expireSessionAfterPeriod: 1800000, develMode: false, enableSecurityManager: false, database: { driver="postgres-jdbc", url: "jdbc:postgresql://localhost:5432/postgres-milton", user: "postgres", password: "postgres", createDatabase: true, initialDataConfiguration: "conf/initial-data.conf", pool: { minIdleConnections: 4, maxIdleConnections: 10, maxConnections: 100, validationQuery: "SELECT 1" } } }, app: { anonymousAccessEnabled: true, anonymousUserRole: "user", supportsCustomConnections: false, forwardProxy: false, publicCredentialsSaveEnabled: true, adminCredentialsSaveEnabled: true, resourceManagerEnabled: true, resourceQuotas: { dataExportFileSizeLimit: 10000000, resourceManagerFileSizeLimit: 500000, sqlMaxRunningQueries: 100, sqlResultSetRowsLimit: 100000, sqlResultSetMemoryLimit: 2000000, sqlTextPreviewMaxLength: 4096, sqlBinaryPreviewMaxLength: 261120 }, enabledAuthProviders: [ "local" ], disabledDrivers: [ "sqlite:sqlite_jdbc", "h2:h2_embedded", "clickhouse:yandex_clickhouse" ] } } ``` ![image](https://user-images.githubusercontent.com/52106718/191063140-4ad509bf-ffed-4221-a255-69591db2a679.png) run cloudbeaver project in eclipse "RUN -> RUN CONFIGURATIONS -> CloudbeaverServer.product -> RUN " ![image](https://user-images.githubusercontent.com/52106718/191060560-e01ea7df-a198-46d4-b082-19bc978402e5.png) Console: ![image](https://user-images.githubusercontent.com/52106718/191061780-215850f9-4ab8-4b06-83c3-26ac766bd3e7.png) automatic table creation ![image](https://user-images.githubusercontent.com/52106718/191061964-bc572ba2-b888-4146-b99b-d42cb828cb5c.png) ![image](https://user-images.githubusercontent.com/52106718/191062256-dc802d9b-93c1-4920-831c-91cf921fe9b3.png)
Author
Owner

@alexander-skoblikov commented on GitHub (Sep 23, 2022):

@miltonchirinos44 Hi, you can change cloudbeaver/config/sample-databases/DefaultConfiguration/cloudbeaver.conf

<!-- gh-comment-id:1256393689 --> @alexander-skoblikov commented on GitHub (Sep 23, 2022): @miltonchirinos44 Hi, you can change [cloudbeaver/config/sample-databases/DefaultConfiguration/cloudbeaver.conf](https://github.com/dbeaver/cloudbeaver/blob/5078102b392d96fd100a805063beca0fd05b9c3e/config/sample-databases/DefaultConfiguration/cloudbeaver.conf)
Author
Owner

@miltonchirinos44 commented on GitHub (Sep 26, 2022):

@alexander-skoblikov
Thanks I managed to solve the problem

<!-- gh-comment-id:1258140171 --> @miltonchirinos44 commented on GitHub (Sep 26, 2022): @alexander-skoblikov Thanks I managed to solve the problem
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/cloudbeaver#244
No description provided.