Setting the schema of PostgreSQL to the datasource in JBoss EAP 7

Solution Verified - Updated -

Issue

  • We have an issue configuring a PostgreSQL database in the standalone.xml file as a datasource. Currently, the datasource looks like this:
                <datasource jndi-name="java:jboss/datasources/ExmpleDS" pool-name="ExampleDS" enabled="true" use-java-context="true">
                    <connection-url>jdbc:postgresql://IP_address:5432/exmaple_database</connection-url>
                    <driver>postgresql</driver>
                    <pool>
                        <min-pool-size>1</min-pool-size>
                        <max-pool-size>100</max-pool-size>
                    </pool>
                    <security>
                        <user-name>database_user</user-name>
                        <password>xxxxxxxxxx</password>
                    </security>
                    <statement>
                        <prepared-statement-cache-size>10</prepared-statement-cache-size>
                        <share-prepared-statements>true</share-prepared-statements>
                    </statement>
                </datasource>
  • Our application can connect to the database, but the first access fails because the first table can not be found. I assume the reason is because we are using different schemas on the database. Obviously, I have to name the schema in the datasource somehow, but I don't know how I could do that.
Caused by: org.postgresql.util.PSQLException: ERROR: relation "tableName" does not exist

Environment

  • Red Hat JBoss Enterprise Application Platform
    • 7.x

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content