ibatis-user-cs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kaushal Chandrashekar" <kaus...@vcasel.com>
Subject Problem using SqlMapper.OpenConnection(string connectionstring)
Date Wed, 06 Sep 2006 19:08:44 GMT
Hi All,
    I'm using the .NET Ibatis DLL where I can open a connection
using a connection string not from the SqlMap.config ( Brilliant
improvement, by the way!) . The code that I'm using is as follows:

       		using (IDalSession session =
				result =
This section of code is called periodically within a method that returns
staff personal information from the DB. I also have other methods that
use regular ADO.NET to perform SQL queries. 
I was running a test where once I run my software, and turn off the SQL
Server. As expected, I get exceptions, but I keep the service running
after logging errors as I want to not kill the service on database
failures, but keep retrying. Once I turn the database back on, the
regular SQL queries return data but the Ibatis queries return the
following error:
IBatisNet.DataMapper.Exceptions.DataMapperException: SqlMap could not
invoke OpenConnection(). A connection is already started. Call
CloseConnection first.
   at IBatisNet.DataMapper.SqlMapper.OpenConnection(String
<Rest of stack trace within my application>

I took a look at the DLL disassembled using .NET reflector and the
problem is at the following:

      if (this._sessionHolder.LocalSession != null)
            throw new DataMapperException("SqlMap could not invoke
OpenConnection(). A connection is already started. Call CloseConnection
      SqlMapSession session1 = new SqlMapSession(this);
      return session1;

The LocalSession does not seem to become null, if there is a
communication failure with the server. Am I doing something wrong? Is
there a way to make the localsession null? Please help.  
Thanks in advance,

View raw message