Implement your own mapper class. In the InitMapper() method you can configure your DataSource on the fly as in the example:
--- Mapper.cs ----- using System.Xml; using IBatisNet.Common.Utilities; using IBatisNet.DataMapper; using IBatisNet.DataMapper.Configuration; using System.Diagnostics; using System.Configuration; namespace wfConsultaCommon { public class Mapper { private static volatile SqlMapper _Mapper = null; protected static void Configure(object obj) { _Mapper = null; } protected static void InitMapper() { DomSqlMapBuilder builder = new DomSqlMapBuilder(); XmlDocument sqlMapConfig = Resources.GetConfigAsXmlDocument("SqlMap.config"); ((sqlMapConfig["sqlMapConfig"]["database"]["dataSource"]).Attributes[1]).Value = "Data Source=(DESCRIPTION =(ADDRESS = (PROTOCOL = TCP)(HOST = " + ConfigurationManager.AppSettings["DataHost"] + ")(PORT = " + ConfigurationManager.AppSettings["DataPort"] + "))(CONNECT_DATA = (SERVER = DEDICATED)(SID = " + ConfigurationManager.AppSettings["DataOSID"] + ")));User ID=" + ConfigurationManager.AppSettings["DataUser"] + ";Password=" + ConfigurationManager.AppSettings["DataPass"]; _Mapper = builder.Configure(sqlMapConfig) as SqlMapper; } public static SqlMapper Instance() { if (_Mapper == null) { lock (typeof(SqlMapper)) { if (_Mapper == null) { InitMapper(); } } } return _Mapper; } public static SqlMapper Get() { return Instance(); } public static void Clear() { lock (typeof(SqlMapper)) { _Mapper = null; } } } } --- End of Mapper.cs ----- In this case, we mantain the DataHost, DataPort, DataOSID, DataUser and DataPass in web.config because a thread is changing these values each half hour. If you need to pass your own user and pass... then maybe you can use iBatis with: Instance(myuser, mypass).Queryfor{...} --> The Instance() method then pass the user and pass to the InitMapper(user, pass) method. Greetings! 2010/3/20 aranja0 <aran...@gmail.com>: > > How can I use my own connection Provider when using iBatis Data Mapper? I > have to use UserId and Password of the user performing the db operation in > the ConnectionString? E.g. The following ConnectionString has to be modified > to insert the userid and password for user performing the db operation. > > Data Source=TEST;Persist Security Info=True;User > ID={userID};Password={password} > > How can this be handled in iBatis DataMapper? > -- > View this message in context: > http://old.nabble.com/How-can-I-use-my-own-connection-Provider-when-using-iBatis-Data-Mapper--tp27967371p27967371.html > Sent from the iBATIS - User - Cs mailing list archive at Nabble.com. > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: user-cs-unsubscr...@ibatis.apache.org > For additional commands, e-mail: user-cs-h...@ibatis.apache.org > > -- Juan Pablo Araya 787 76 034 --------------------------------------------------------------------- To unsubscribe, e-mail: user-cs-unsubscr...@ibatis.apache.org For additional commands, e-mail: user-cs-h...@ibatis.apache.org