Custom DataSourceFactory also worked for me. The trick was to create one big 
config string and use it in the 
org.apache.openejb.resource.jdbc.DataSourceFactory.create(). 
Something like this:

<resources>

    <Resource id="myDS" type="javax.sql.DataSource" 
class-name="com.bla.bla.DataSourceFactory" factory-name="create">
        JdbcDriver   = org.postgresql.Driver
    </Resource>
</resources>

Public class DataSourceFactory {

public Object create() {

        String definition = "JtaManaged=true\n" +
                        "JdbcDriver=org.postgresql.Driver\n" +
                        "JdbcUrl=yourUrl\n" +
                        "UserName=yourUser\n" +
                        "Password=yourPassword\n" +
                        "PasswordCipher=PlainText\n" +
                        "OpenEJBResourceClasspath=false\n" + ...;

        return 
org.apache.openejb.resource.jdbc.DataSourceFactory.create("someDS", true, 
org.postgresql.Driver.class,
                definition, null, null, null, false);
   }
}

Cheers,
Dmitry


-----Original Message-----
From: randygalbraith [mailto:regalbra...@aetna.com.INVALID] 
Sent: Monday, December 2, 2019 2:32 PM
To: users@tomee.apache.org
Subject: RE: Supplying a JDBC password at run-time.

Hi Dmitry,

Interesting. I did not know ${} syntax within resources.xml would pull in 
values from the environment. Alas, that would not work in my case, since our 
Oracle password is not and cannot be an environment variable.

Cheers,
-Randy



--
Sent from: 
https://urldefense.com/v3/__http://tomee-openejb.979440.n4.nabble.com/TomEE-Users-f979441.html__;!LLC3CZw_jFA!OtvzO-Y8s49lf9J1CSZUZwMO_WknI9cxY6N-BAQkYZkEk5Z-Dy_qWfm87gHUZKSIjqmN$
 

Reply via email to