ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paul Sanders <tendan...@gmail.com>
Subject Re: How can I change datasource connect info on the fly w/iBATIS and Spring?
Date Fri, 13 Apr 2007 21:27:21 GMT

Interesting.... but you are right, our datasource info is not known in
advance though some are stored in a table and fetched at runtime when the
user selects it from a drop down in the browser. And of course they can
create one on the fly, too.

I wonder if the answer is to unwire the datasource from the DAO bean and
inject it by hand in the controller method. I lose the niceness of the
Spring framework for this particular task but I think it should work?


Chris Lamey wrote:
> Yea, Spring has a new AbstractRoutingDataSource that can route to a
> different datasource based on a ThreadLocal.  The problem is that the
> iBATIS SqlMapClient doesn't know the datasource isn't the same between
> calls, so your caching gets horked.
> I don't know if it'll work for you because your datasources have to be
> known in advance and it sounds like yours may not be.
> Cheers,
> Chris

View this message in context: http://www.nabble.com/How-can-I-change-datasource-connect-info-on-the-fly-w-iBATIS-and-Spring--tf3573169.html#a9986772
Sent from the iBATIS - User - Java mailing list archive at Nabble.com.

View raw message