Unfortunately I still have problems. Below I have pasted the
configuration after I have moderated it.
I have configured the provider like this:
-- snip --
<provider
name="oracleClient1.0"
description="MS Oracle provider V1.0.5"
enabled="true"
default="false"
assemblyName="System.Data.OracleClient,
Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
connectionClass="System.Data.OracleClient.OracleConnection"
commandClass="System.Data.OracleClient.OracleCommand"
parameterClass="System.Data.OracleClient.OracleParameter"
parameterDbTypeClass="System.Data.OracleClient.OracleType"
parameterDbTypeProperty="OracleType"
dataAdapterClass="System.Data.OracleClient.OracleDataAdapter"
commandBuilderClass="System.Data.OracleClient.OracleCommandBuilder"
usePositionalParameters = "false"
useParameterPrefixInSql = "true"
useParameterPrefixInParameter = "false"
parameterPrefix=":"
/>
-- snip --
The (new) context in the dao.config looks like this:
-- snip --
<context id="OracleMapDao" default="false">
<daoSessionHandler id="OracleMap">
<property name="OracleMapConfigFile"
value="OracleMap.config"/>
</daoSessionHandler>
<database>
<provider name="oracleClient1.0"/>
<dataSource name="OracleServer"
connectionString="Data Source=SERVICE;User
Id=USER;Password=PASS;Integrated Security=no;" />
</database>
<daoFactory/>
</context>
-- snip --
And finally the OracleMap.config file:
-- snip --
<?xml version="1.0" encoding="utf-8"?>
<sqlMapConfig xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="SqlMapConfig.xsd">
<settings>
<setting useStatementNamespaces="false"/>
<setting cacheModelsEnabled="false"/>
</settings>
<database>
<provider name="oracleClient1.0"/>
<dataSource name="OracleServer"
connectionString="Data Source=SERVICE;User
Id=USER;Password=PASS;Integrated Security=no;" />
</database>
<sqlMaps>
<sqlMap resource="DBMaps/OracleMap.xml" />
</sqlMaps>
</sqlMapConfig>
-- snip --
Can you spot any configuration errors that might be causing the problem?
Thanks in regards,
Jess
-----Original Message-----
From: Ron Grabowski [mailto:[EMAIL PROTECTED]
Sent: Wednesday, September 28, 2005 4:57 PM
To: [email protected]
Subject: Re: URGENT - Connecting to both Oracle and SqlServer - PLEASE
HELP
Your dao.config file should look more like this:
<?xml version="1.0" encoding="utf-8"?>
<daoConfig
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="DaoConfig.xsd">
<context id="SqlServer">
<daoSessionHandler id="SqlMap">
<property name="sqlMapConfigFile" value="SqlMap.config"/>
</daoSessionHandler>
<database>
<provider name="sqlServer1.1"/>
<dataSource name="SqlServer"
connectionString="data source=HOST;database=DB;user
id=USER;password=PASS;"/>
</database>
<daoFactory>
<!-- you need add dao nodes to map interfaces with implementations
-->
</daoFactory>
</context>
<context id="Oracle">
<daoSessionHandler id="SqlMap">
<property name="sqlMapConfigFile" value="OracleMap.config"/>
</daoSessionHandler>
<database>
<provider name="oracleClient1.0"/>
<dataSource name="OracleServer"
connectionString="Data Source=SERVICE;User
Id=USER;Password=PASS;Integrated Security=no;" />
</database>
<daoFactory>
<!-- you need add dao nodes to map interfaces with implementations
-->
</daoFactory>
</context>
</daoConfig>
You request a specific dao using its context id:
DaoManager sqlServerDaoManager = DaoManager.GetInstance("SqlServer");
DaoManager oracleDaoManager = DaoManager.GetInstance("Oracle");
You need to add dao nodes to your daoFactory nodes so you can request
interfaces from the dao manager object:
IUserDao userDao = (IUserDao)oracleDaoManager[typeof(IUserDao)];
IList users = userDao.GetMany();
In your provider.config file, having two provider nodes each marked
with:
default="true"
may cause problems.
In OracleMap.config, the database node:
<database>
<provider name="oracleClient1.0"/>
<dataSource name="OracleServer" connectionString="..." />
</database>
is ignored when using dao objects so you can comment it out or remove
it.
I would verify that IBatisNet is working the way you want before trying
to integrate it with Spring.
--- Jess Nielsen <[EMAIL PROTECTED]> wrote:
> Hi there
>
> I'm trying to configure ibatis so it wil be using two different
> databases (oracle and sqlserver) concurrently. I have been using
> several hours on this without success and hope that some of you guys
> in here can help me. The error I keep getting is the usual:
> Spring.Objects.Factory.ObjectCreationException
>
> The connection to the SQL Server is working out of the box, when the
> Oracle configuration hasn't been added. As soon as I add the
> configuration for the Oracle it will fail. Does anyone know how to
> configure ibatis so the setup will work?
>
> I hope for a soon reply on this.
>
> Thanks in regards,
> Jess