ibatis-user-cs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Nguyen, Tom" <Tom.Ngu...@rels.info>
Subject RE: System.Data.SqlClient.SqlException: Invalid object
Date Thu, 10 May 2007 15:33:01 GMT
Well, the solution is depend on what you are doing:


1) If you are using the DataAccess.dll (DaoManager) then:


I don't quite remember the DaoManager, but I think it goes something




Then you get the correct configuration to different database with:

IdaoManager daoManager1 = DaoManager.GetInstance("SimpleDao");


IDaoManager daoManager2 = DaoManager.GetInstance("SqlMapDao");



2) If you use the DataMapper directly, then you can separate your
sqlMap.config into different files and do something like:


DomSqlMapBuilder builder = new DomSqlMapBuilder()

ISqlMapper map = builder.configure(new


DomSqlMapBuilder builder = new DomSqlMapBuilder()

ISqlMapper map = builder.configure(new



3) 3rd method is to use the IDataSource hack, the one that allow you to
use for multiple user.

Consider you have both database configure in an single config file.




Remember with this method, similar to your currect method, if you are
not in a multiple user environment (call context wise), then you have to
consider concurrency issue with two thread accessing the same session.
You could implement some thread locking but it could slow down your



Personally, I use combination of method 2 and 3:  Single file, multiple
building of the same file and setting different connection string for
each database instance through IDataSource.  It's a little overhead up
front but I only use one instance so I can afford it.


Please feel free to correct me if I'm wrong.



Tom Nguyen 
Sr. Developer
tom.nguyen@rels.info <mailto:tom.nguyen@rels.info> 


From: Campbell, Bob [mailto:BCampbell@UEIC.com] 
Sent: Tuesday, May 08, 2007 7:03 PM
To: user-cs@ibatis.apache.org
Subject: RE: System.Data.SqlClient.SqlException: Invalid object


It's definite, if I avoid switching databases there are no errors.  

I guess the only question left is what's going wrong while switching

Is there something we should be doing differently when switching
connection strings?


Thanks, this help is much appreciated.




This e-mail message and any files transmitted herewith, are intended solely for the
use of the individual(s) addressed and may contain confidential, proprietary or 
privileged information.  If you are not the addressee indicated in this message 
(or responsible for delivery of this message to such person) you may not review, 
use, disclose or distribute this message or any files transmitted herewith.  If you 
receive this message in error, please contact the sender by reply e-mail and delete
this message and all copies of it from your system.

View raw message