3

If all my Spring JDBCTemplate queries have to go through an Oracle VPD (Virtual Private Database) Connection how would I set up my datasource in the Application Context file?

1 Answer 1

2
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
    <property name="driverClassName" value="oracle.jdbc.OracleDriver" />
    <property name="url" value="jdbc:oracle:thin:@xxx.xxx.com" />
    <property name="username" value="user***" />
    <property name="password" value="pass***" />
    <property name="connectionInitSqls">
        <util:list>
              <value>call PKG_RLS.SET_CONTEXT ('admin', '0', 'SET_VALUE')</value>
        </util:list>
    </property>
</bean>
1
  • Doesn't this mean that every time you make a connection you have admin visibility? What about when you want to make a connection as a regular user? There should be a way to dynamically set the parameters. Oct 29, 2018 at 17:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.