ibatis-user-cs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Campbell, Bob" <BCampb...@UEIC.com>
Subject RE: System.Data.SqlClient.SqlException: Invalid object
Date Thu, 10 May 2007 18:00:11 GMT
Thanks everyone for all your help.  

I think I have a good handle on which way to go now.

 

Thanks again!

 

Bob

 

________________________________

From: Nguyen, Tom [mailto:Tom.Nguyen@rels.info] 
Sent: Thursday, May 10, 2007 8:33 AM
To: user-cs@ibatis.apache.org
Subject: RE: System.Data.SqlClient.SqlException: Invalid object

 

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
like:

 

http://ibatis.apache.org/docs/dotnet/dataaccess/ch03s03.html

 

Then you get the correct configuration to different database with:

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

Or

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
System.IO.FileInfo("database1.config"));

Or

DomSqlMapBuilder builder = new DomSqlMapBuilder()

ISqlMapper map = builder.configure(new
System.IO.FileInfo("database2.config"));

 

-----------------------------------

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.

 

http://opensource.atlassian.com/confluence/oss/display/IBATIS/How+do+I+s
et+the+connection+string+per+user+in+Web+context

 

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
performance.

 

---------------------------------

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.

 

Regards,


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
databases?  

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

 

Thanks, this help is much appreciated.

Bob

 

 

________________________________

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. 

________________________________


Mime
View raw message