4.0 Framework and SQL 2008

761 views
Skip to first unread message

Sean

unread,
Apr 25, 2011, 4:08:39 PM4/25/11
to mybatisnet-user
Hi all,
I'm assuming that mybatis 1.9.2 is compatible with .net 4.0. I am
having a problem with setting up the provider for a SQL2008 database.
If someone has one can you post it?

Here is what I have that is giving me and error:
<provider
name="sqlServer2008"
enabled="false"
description="Microsoft SQL Server, provider V4.0.0.0 in
framework .NET V4.0"
assemblyName="System.Data, Version=4.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089"
connectionClass="System.Data.SqlClient.SqlConnection"
commandClass="System.Data.SqlClient.SqlCommand"
parameterClass="System.Data.SqlClient.SqlParameter"
parameterDbTypeClass="System.Data.SqlDbType"
parameterDbTypeProperty="SqlDbType"
dataAdapterClass="System.Data.SqlClient.SqlDataAdapter"
commandBuilderClass=" System.Data.SqlClient.SqlCommandBuilder"
usePositionalParameters = "false"
useParameterPrefixInSql = "true"
useParameterPrefixInParameter = "true"
parameterPrefix="@"
allowMARS="true"
/>

I get the following are with this setup:
Initialization method IbatisTest.UnitTest1.SetUp threw exception.
IBatisNet.Common.Exceptions.ConfigurationException:
IBatisNet.Common.Exceptions.ConfigurationException:
- The error occurred while configure provider.
- The error occurred in <provider name="sqlServer2008" xmlns="http://
ibatis.apache.org/dataAccess" />.
- Check the sqlServer2008. --->
IBatisNet.Common.Exceptions.ConfigurationException: Error while
configuring the Provider named "sqlServer2008" in the Context named
"Media_SQL2008"..

Thanks for the help,
Sean

Michael Schall

unread,
Apr 26, 2011, 12:35:54 PM4/26/11
to mybatis...@googlegroups.com
Are you using the binaries you downloaded?  Or building from source?

If you are using the downloaded binaries, there may be an issue with using a .NET 2.0 assembly and trying to load a .NET 4.0 provider?

We build iBATIS from source targeting 4.0 and we don't have any problems.  We actually didn't change our providers.config file to use the .net 4 version of System.Data but looking at procexp from sysinternals shows that System.Data, Version=4.0.0.0 is the one being used.  .Net must use assembly redirection internally?

I did also try adding the following to my providers config and used it successfully within my configuration as well.  ProcExp still shows that the System.Data assembly loaded is version 4.0.0.0.

	<provider
		name="sqlServer4.0"
		description="Microsoft SQL Server, provider V4.0.0.0 in framework .NET V4.0"
		default="false"
		assemblyName="System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
		connectionClass="System.Data.SqlClient.SqlConnection"
		commandClass="System.Data.SqlClient.SqlCommand"
		parameterClass="System.Data.SqlClient.SqlParameter"
		parameterDbTypeClass="System.Data.SqlDbType"
		parameterDbTypeProperty="SqlDbType"
		dataAdapterClass="System.Data.SqlClient.SqlDataAdapter"
		commandBuilderClass="System.Data.SqlClient.SqlCommandBuilder"
		usePositionalParameters = "false"
		useParameterPrefixInSql = "true"
		useParameterPrefixInParameter = "true"
		parameterPrefix="@"
	/>

Sean

unread,
Apr 26, 2011, 1:48:31 PM4/26/11
to mybatisnet-user
Thanks Mike,
I'm using the downloaded dlls for 1.9.2. I got passed my original
post by making sure the config and xml files have the proper
namespaces.

I'm having a secondary issue: {"Error configuring DAO. Cause:
Ambiguous match found."}.

Will try to build the source targeted as 4.0 framework to see if this
fixes my problem. (Where can I get the code for the DataAccess? I
cannot locate on http://code.google.com/p/mybatisnet/)

I have seen this error on the interwebz and on this group board, but I
haven't seen a solution. Has anyone been able to to correct this
error.
I'm sure it is something very small. It is always the little things
that make you crazy.



Thanks,
Sean

Michael Schall

unread,
Apr 26, 2011, 2:53:25 PM4/26/11
to mybatis...@googlegroups.com
Unfortunately I will not be any help as we do not use the DAO library.  Hopefully someone else can chime in...

Sorry

Michael Schall

unread,
Apr 26, 2011, 2:58:16 PM4/26/11
to mybatis...@googlegroups.com
This looks to be an issue in Castle.DynamicProxy.  Someone was having a similar issue using NHIbernate and has an answer on stackoverflow.  You might be able to try the same...

Sean Tucker

unread,
Apr 26, 2011, 3:17:41 PM4/26/11
to mybatis...@googlegroups.com

I found that to.  I got the latest Castle dll, but they combined the .DynamicProxy into the .Core.   I have this included in the Ibatis.DataMapper source.   I need to do the same with the Ibatis.DataAccess source.  I just found source code for the DataAccess but its data 2008. 

 

I’m not working a production project, I’m just working on a sample project in 4.0 to get more familiar with it (MVC3, Silverlight, and a little JQuery – and iBatis if it would cooperate).  It all for fun.

 

Thanks for your help Mike!

Michael Schall

unread,
Apr 26, 2011, 3:56:40 PM4/26/11
to mybatis...@googlegroups.com
I think you would need to download the source for Castle.DynamicProxy 1.1.5 to make the changes.  I can't seem to find a spot to download that source.  Luckily I have it checked into our svn in a vendor branch.  This is the code as I downloaded it and marked as version 1.1.5.  The AssemblyInfo.cs file has that version in it as well.  No guarantees :)  I suppose you could use a diff tool like nDepend to see if the code is identical to what is compiled and distributed...

Hope this helps

Mike
DynamicProxy.1.1.5.zip

rghazarian

unread,
Apr 28, 2011, 9:04:49 PM4/28/11
to mybatisnet-user
I just tested the fix at Stack Overflow w/ .NET 4.0 and iBatis.NET
DataAccess 1.9.2.0 and it worked like a charm. I used the source code
at https://sourceforge.net/projects/castleproject/files/Castle%20Project/Release%20Candidate%203/

Thanks for your help.

Rafi

On Apr 26, 12:56 pm, Michael Schall <mike.sch...@gmail.com> wrote:
> I think you would need to download the source for Castle.DynamicProxy 1.1.5
> to make the changes.  I can't seem to find a spot to download that source.
>  Luckily I have it checked into our svn in a vendor branch.  This is the
> code as I downloaded it and marked as version 1.1.5.  The AssemblyInfo.cs
> file has that version in it as well.  No guarantees :)  I suppose you could
> use a diff tool like nDepend to see if the code is identical to what is
> compiled and distributed...
>
> Hope this helps
>
> Mike
>
>
>
> On Tue, Apr 26, 2011 at 2:17 PM, Sean Tucker <seantucke...@gmail.com> wrote:
> > I found that to.  I got the latest Castle dll, but they combined the
> > .DynamicProxy into the .Core.   I have this included in the
> > Ibatis.DataMapper source.   I need to do the same with the Ibatis.DataAccess
> > source.  I just found source code for the DataAccess but its data 2008.
>
> > I’m not working a production project, I’m just working on a sample project
> > in 4.0 to get more familiar with it (MVC3, Silverlight, and a little JQuery
> > – and iBatis if it would cooperate).  It all for fun.
>
> > Thanks for your help Mike!
>
> > *From:* mybatis...@googlegroups.com [mailto:
> > mybatis...@googlegroups.com] *On Behalf Of *Michael Schall
> > *Sent:* Tuesday, April 26, 2011 2:58 PM
> > *To:* mybatis...@googlegroups.com
> > *Subject:* Re: 4.0 Framework and SQL 2008
>
> > This looks to be an issue in Castle.DynamicProxy.  Someone was having a
> > similar issue using NHIbernate and has an answer on stackoverflow.  You
> > might be able to try the same...
>
> >http://stackoverflow.com/questions/3301157/nhibernate-1-2-in-a-net-4-...
>
> > On Tue, Apr 26, 2011 at 1:53 PM, Michael Schall <mike.sch...@gmail.com>
> > wrote:
>
> > Unfortunately I will not be any help as we do not use the DAO library.
> >  Hopefully someone else can chime in...
>
> > Sorry
>
> > On Tue, Apr 26, 2011 at 12:48 PM, Sean <seantucke...@gmail.com> wrote:
>
> > Thanks Mike,
> > I'm using the downloaded dlls for 1.9.2.   I got passed my original
> > post by making sure the config and xml files have the proper
> > namespaces.
>
> > I'm having a secondary issue: {"Error configuring DAO. Cause:
> > Ambiguous match found."}.
>
> > Will try to build the source targeted as 4.0 framework to see if this
> > fixes my problem.  (Where can I get the code for the DataAccess?  I
> > cannot locate onhttp://code.google.com/p/mybatisnet/)
>  DynamicProxy.1.1.5.zip
> 127KViewDownload- Hide quoted text -
>
> - Show quoted text -

in dev

unread,
May 3, 2011, 11:38:25 AM5/3/11
to mybatis...@googlegroups.com
Dear Sean,
 
I am using MyBatis 1.9.2 with .net 4.0 and SQL2008. The following is the provider config that I am using for SQL Server2008.
 
 <provider
     name="sqlServer2008"
     enabled="true"
     default="true"

     description="Microsoft SQL Server, provider V4.0.0.0 in framework .NET V4.0"
     assemblyName="System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
     connectionClass="System.Data.SqlClient.SqlConnection"
     commandClass="System.Data.SqlClient.SqlCommand"
     parameterClass="System.Data.SqlClient.SqlParameter"
     parameterDbTypeClass="System.Data.SqlDbType"
     parameterDbTypeProperty="SqlDbType"
     dataAdapterClass="System.Data.SqlClient.SqlDataAdapter"
     commandBuilderClass=" System.Data.SqlClient.SqlCommandBuilder"
     usePositionalParameters = "false"
     useParameterPrefixInSql = "true"
     useParameterPrefixInParameter = "true"
     parameterPrefix="@"
     allowMARS="true"
    />
I hope that helps.
 
Cheers!
Reply all
Reply to author
Forward
0 new messages