That code change was just for Sunil to try out Firebird in his test project.  Aside from MySql.Data, the other providers tested don't seem to have a problem with cloning connections that don't have connectionstrings set.  Still, it is sortof odd to return a clone when there's no conn string set which is probably what the MySql and Npgsql folks were thinking when implementing ICloneable.

Roberto

On 5/19/05, Ron Grabowski <[EMAIL PROTECTED]> wrote:
Hrmm, the _templateConnectionIsICloneable optimization might not be as
useful as I thought it was. It looks like there's a good chance
CreateInstance will be called in almost every case. When the connection
provider is first loaded its ConnectionString is most likely null or
the empty.string already. I don't recall seeing code in the source
where the _templateConnection's ConnectionString property is every set.
There's no SetTemplateConnectionString method. I believe its the
calling function's (the method that calles GetConnection())
responsibility to ensure a proper connection string. Perhaps its
simpler to just revert to the original code:

return (IDbConnection)
Activator.CreateInstance(_templateConnection.GetType());

--- Roberto R < [EMAIL PROTECTED]> wrote:

> That's good since that's the connectionstring error with Clone() that
> I
> mentioned in an earlier email:
>
>
http://www.mail-archive.com/ibatis-user-cs%40incubator.apache.org/msg00389.html
>
> Since you have the code, modify the following in
> IBatisNet.Common.Provider.GetConnection() to get around the Clone
> error (
> MySql.Data also has this problem but MySql with ByteFx doesn't!)
>
> if (_templateConnectionIsICloneable)
>  {
>  if (_templateConnection.ConnectionString != null &&
> _templateConnection.ConnectionString != "")
>  {
>  return (IDbConnection) ((ICloneable)_templateConnection).Clone();
>  }
>  else
>  {
>  return (IDbConnection) Activator.CreateInstance
> (_templateConnection.GetType());
>  }
> }
> else
> {
> return (IDbConnection) Activator.CreateInstance
> (_templateConnection.GetType());
> }
>
>
> Roberto
>
>
> On 5/18/05, Sunil Sreedharan <[EMAIL PROTECTED]> wrote:
> >
> > Hi,
> > The databases in both the paths you specified are the
> > same. I just moved it around from "Program Files" path
> > to check if the space in the folder name was creating
> > a problem.
> >
> > I have modified the connection string to the below one
> > as suggested by you.
> >
> > <dataSource name="Firebird1.7"
> >
> >
>
connectionString="DataSource=localhost;Port=3050;User=SYSDBA;Password=masterkey;database=C:\\WebSites\\WebSite1\\DB\\EMPLOYEE.FDB;Role=;Connection
> > lifetime=30;Pooling=true;Packet
> > Size=8192;Charset=UNICODE_FSS;"/>
> >
> > Have tried User, UserId and User Id. Have also tried
> > with a single "\" in the path. Have also tried with a
> > "/".
> >
> > The iMapper has also been modified to a single line of
> > code now. I have not yet changed the iBatis source. Is
> > that necessary?
> >
> > I now get a different error which is posted below. Any
> > idea what is wrong with the connection string?
> >
> > ******** Error Start********
> > An invalid connection string argument has been
> > supplied or a required connection string argument has
> > not been supplied.
> > Description: An unhandled exception occurred during
> > the execution of the current web request. Please
> > review the stack trace for more information about the
> > error and where it originated in the code.
> >
> > Exception Details: System.ArgumentException: An
> > invalid connection string argument has been supplied
> > or a required connection string argument has not been
> > supplied.
> >
> > Source Error:
> >
> >
> > Line 34:
> > Line 35: Label2.Text =
> > map.DataSource.Provider.ToString
> > Line 36: Dim list As IList =
> > iMapper.Instance.QueryForList("GetCustomer", Nothing)
> > Line 37: 'Dim i As Integer
> > Line 38: 'For i = 0 To list.Count - 1
> >
> >
> > Source File: C:\WebSites\WebSite1\FBTest.aspx.vb
> > Line: 36
> >
> > Stack Trace:
> >
> >
> > [ArgumentException: An invalid connection string
> > argument has been supplied or a required connection
> > string argument has not been supplied.]
> >
> > FirebirdSql.Data.Firebird.FbConnectionString.Validate()
> > +530
> >
> > FirebirdSql.Data.Firebird.FbConnection.set_ConnectionString(String
> > value) +86
> > FirebirdSql.Data.Firebird.FbConnection..ctor(String
> > connectionString) +84
> >
> > FirebirdSql.Data.Firebird.FbConnection.System.ICloneable.Clone()
> > +40
> > IBatisNet.Common.Provider.GetConnection () +27
> > IBatisNet.DataMapper.SqlMapSession.OpenConnection()
> > +44
> > IBatisNet.DataMapper.SqlMapper.QueryForList(String
> > statementName, Object parameterObject) +103
> > FBTest_aspx.Page_Load(Object sender, EventArgs e)
> > in C:\WebSites\WebSite1\FBTest.aspx.vb:36
> > System.Web.UI.Control.OnLoad(EventArgs e) +87
> > System.Web.UI.Control.LoadRecursive() +55
> > System.Web.UI.Page.ProcessRequestMain(Boolean
> > includeStagesBeforeAsyncPoint, Boolean
> > includeStagesAfterAsyncPoint) +2836
> >
> >
> > *******End of Error*****
> >
> > Regards
> > Sunil
> >
> >
> >
> >
> > __________________________________
> > Yahoo! Mail Mobile
> > Take Yahoo! Mail with you! Check email on your mobile phone.
> > http://mobile.yahoo.com/learn/mail
> >
>


Reply via email to