ibatis-user-cs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From oleksa borodie <oleksa.boro...@gmail.com>
Subject Re: How to configure Ibatis to use two different IBatis mappers(not nHibernate) for two databases and using IBatis DAO?
Date Wed, 20 Jul 2005 15:44:05 GMT
Hello 

> 1º - I have to persist objets in TWO different databases (Informix and SQL
> Server)
> 2º - I have to use TWO IBatis Mappers (Informix and SqlServer)
> 3º - I have to use DaoManager to manage my DAO objects.
>         ex: DaoManager.GetInstance("InformixMapDAO") and
> DaoManager.GetInstance("SqlServerMapDAO")

 May be such my code will help you:

private static SqlMapper GetMapper(string sqlmapname)
{
XmlDocument document = new XmlDocument();
document.Load(sqlmapname);
return SqlMapper.Configure(document);
}

This is body of the function that returns SqlMapper configured by file
that name is passed as parameter. Configuration file looks like:

<?xml version="1.0" encoding="UTF-8" ?>
<sqlMapConfig
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
  xsi:noNamespaceSchemaLocation="SqlMapConfig.xsd">

<context name="Scrooge"/>
 <database >
 <provider name="sqlServer1.1"/>
  <dataSource name="ScroogeDB" connectionString="will be set in the run-time"/>
 </database>

 <sqlMaps>
  <sqlMap resource="/Maps/Scrooge.xml"/>
 </sqlMaps>
</sqlMapConfig>

Mime
View raw message