Solution:

ARTIFACTORY: Why Artifactory is unable to connect to DB when DB is configured with the pg bouncer

AuthorFullName__c
Pranav Hegde
articleNumber
000005624
ft:sourceType
Salesforce
FirstPublishedDate
2023-03-19T09:52:00Z
lastModifiedDate
2023-03-19
VersionNumber
1
As we have added the prepareThreshold=0 parameter in the system.yaml to the database connection string URL. Please note from the official postgresql site, once this parameter is enabled, it deactivates/disables the prepared statement and the error we see above is related to prepared statements. As a next step, in order to disable prepared statements in the Metadata microservice, we need to do perform the following changes in the system.yaml file ($JFROG_HOME/artifactory/var/etc ):
shared:
    database:
        type: postgresql
        driver: org.postgresql.Driver
        url: jdbc:postgresql://localhost:6432/artifactory?prepareThreshold=0
        username: artifactory
        password: password
metadata:
    database:
        type: postgresql
        url: go:user='artifactory' password='*******' dbname=artifactory host=localhost port=6432 sslmode=disable statement_cache_mode=describe
        disablePreparedStatementCache: true

NOTE: Make sure to add above changes with the proper indentation. Restart the Artifactory instance for the changes to take effect. In some cases, even though Artifactory service is up and running, Artifactory UI package view of artifacts might fail with the 500 error or sometimes, Artifactory itself won’t come up due to the metadata service issue.