Nicolas Davyt [
http://community.jboss.org/people/nicolasdavyt1234] created the discussion
"Re: Datasource security"
To view the discussion, visit:
http://community.jboss.org/message/574268#574268
--------------------------------------------------------------
Maybe you cant try with define 2 or 3 <jndi-name> with diferent username and
password with respective privileges defined at the database. (only select, full acces,
etc)
*<local-tx-datasource>
<jndi-name>TradeTestOracle_ONLY_SELECT_DS</jndi-name>
<connection-url>jdbc:oracle:thin:@trmpd_pkg.bankers.com:1521:trmpd</connection-url>
<driver-class>oracle.jdbc.driver.OracleDriver</driver-class>
<max-pool-size>100</max-pool-size>
<user-name>boatradeONLY_SELECT</user-name>
<password>test1</password>
<exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.OracleExceptionSorter</exception-sorter-class-name>
<metadata>
<type-mapping>Oracle9i</type-mapping>
</metadata>
</local-tx-datasource>*
*<local-tx-datasource>
<jndi-name>TradeTestOracle_ALL_ACCESS_DS</jndi-name>
<connection-url>jdbc:oracle:thin:@trmpd_pkg.bankers.com:1521:trmpd</connection-url>
<driver-class>oracle.jdbc.driver.OracleDriver</driver-class>
<max-pool-size>100</max-pool-size>
<user-name>boatrade**_ALL_ACCESS_**</user-name>
<password>test1</password>
<exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.OracleExceptionSorter</exception-sorter-class-name>
<metadata>
<type-mapping>Oracle9i</type-mapping>
</metadata>
</local-tx-datasource>*
And in you code like for example: (in your dataBase Connection class.)
public static Connection getConnection( User user)
......
if (user.equals("Bob"))
ds = (DataSource) iniCtx.lookup("*TradeTestOracle_ONLY_SELECT_DS"*);
else if (user.equals("John"))
ds = (DataSource) iniCtx.lookup("*TradeTestOracle_ALL_ACCESS_DS**"*);
.......
--------------------------------------------------------------
Reply to this message by going to Community
[
http://community.jboss.org/message/574268#574268]
Start a new discussion in Datasource Configuration at Community
[
http://community.jboss.org/choose-container!input.jspa?contentType=1&...]