Hi all,
I am facing an issue on how to set the Datasource using PropertyPlaceholderConfigurer.
My datasource configuration is like this:
And since my web down through DAO are using Spring beansCode:<bean id="dataSource" destroy-method="close" class="org.apache.commons.dbcp.BasicDataSource"> <property name="driverClassName" value="com.ibm.db2e.jdbc.DB2eDriver"/> <property name="url" value="${jdbc.url}"/> <property name="username" value="${jdbc.username}"/> <property name="password" value="${jdbc.password}"/> </bean>
and JSF managed beans, so I must use application context approach which means loading them with
My application contexts consists ofCode:org.springframework.web.context.ContextLoaderServlet
I put the above dataSource definition inside applicationContext-dao.xml.Code:applicationContext-web.xml, applicationContext-service.xml and applicationContext-dao.xml
The most difficult part is that I can not use properties files such
as jdbc.properties to change the above placeholders, since
i need the DB URL, User Id and Password to be determined at Login time.
DB URL to be determined at runtime? Yeah this is special case since
DB2e database will access the database based on downsynced data
which is something like
Hence I need those 3 information to be determined after login.Code:jdbc:db2e:C:\fooProject\<userId>\
The thing is all these 3 contexts are initialized at runtime,
but the datasource is not defined yet.
Just fyi, I have tried UserCredentialsDataSourceAdapter but DB2e does not
support it.
Anybody has idea about this?
Thanks in advance.


Reply With Quote