JBoss Community

Help with datasource dynamic credentials.

created by Jonathan Pinto Sperafico in Datasource Configuration - View the full discussion

Hi JBoss Comunity's members.

 

For a couple months I have been studing JBoss and

about 2 weeks or so, I'm stuck at datasource dynamic security.

So if is possible, please I would like a hand on it.

 

In my system I had the standalone.xml file describled below.

 

           <datasources>
                <datasource jta="true" jndi-name="java:/SQLServer2008" pool-name="SQLServer2008" enabled="true" use-java-context="true" use-ccm="true">
                    <connection-url>jdbc:sqlserver://YYYYYY:XXXX;databaseName=TESTE</connection-url>
                    <driver>sqlserver2008</driver>
                    <pool>
                        <min-pool-size>5</min-pool-size>
                        <max-pool-size>10</max-pool-size>
                        <prefill>true</prefill>
                        <use-strict-min>true</use-strict-min>
                    </pool>
                    <security>
                        <user-name>xxxxxxxx</user-name>
                        <password>yyyyyy</password>
                    </security>
                    <validation>
                        <valid-connection-checker class-name="org.jboss.jca.adapters.jdbc.extensions.mssql.MSSQLValidConnectionChecker"/>
                    </validation>
                    <timeout>
                        <idle-timeout-minutes>0</idle-timeout-minutes>
                        <query-timeout>600</query-timeout>
                    </timeout>
                    <statement>
                        <track-statements>true</track-statements>
                        <prepared-statement-cache-size>10</prepared-statement-cache-size>
                    </statement>
                </datasource>
                <drivers>
                    <driver name="sqlserver2008" module="com.microsoft.sqlserver">
                        <driver-class>com.microsoft.sqlserver.jdbc.SQLServerDriver</driver-class>
                    </driver>
                </drivers>
            </datasources>

 

And my persistence.xml as well.

 

<persistence version="2.0"
             xmlns="http://java.sun.com/xml/ns/persistence" 
             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
             xsi:schemaLocation="http://java.sun.com/xml/ns/persistence 
                     http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
    
    <persistence-unit name="AAAAAAAAAAA" transaction-type="JTA">
            <provider>org.hibernate.ejb.HibernatePersistence</provider>
            <jta-data-source>SQLServer2008</jta-data-source>
            <class>br.com.iob.folio.modelo.Teste</class>
            <properties>
                <property name="hibernate.dialect" value="org.hibernate.dialect.SQLServerDialect"/>
                <property name="hibernate.cache.use_second_level_cache" value="true"/>
            </properties>
    </persistence-unit>
    
</persistence>

 

As you can see in my standalone.xml has my security credentials to the Database's login.

What I would like to do, is make it dynamic. I would like to pass the credential through the EJB (So far, so good).

But the problem is how can I connect to the JDBC with theses dynamic credentials using

the current approach? Is it possible to do it?

 

I really do appreciate you help on it,

Best wishes to all,

Jonathan Pinto Sperafico

Reply to this message by going to Community

Start a new discussion in Datasource Configuration at Community