ibatis.net & sqlserver2005 & provider not loading

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

ibatis.net & sqlserver2005 & provider not loading

alberto.acevedo

I spent several days trying to fix this problem but no success so far. I
found some solutions in the mailing list but none of them worked. I'm
using iBatis.Net (IBatis.DataMapper.1.6.2), Visual Studio 2005, and SQL
server 2005. The problem is that iBatis can't load the provider. This is
my provider in provider.config:

<provider
     name="sqlServer2005"
     enabled="true"
     description="Microsoft SQL Server, provider V2.0.0.0 in framework
.NET V2.0"
     assemblyName="System.Data, Version=2.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 was able to connect to Access using the provider for an Access
database  but It fails with SQL Server 2005. This is the exact error:
Could not configure providers. Unable to load provider named
\"sqlServer2005"\ not found. Cause: The type initializer for
'System.data.sqlClient.SqlConnection' threw an exception.

I supect it is the version and PublicKeyToken. Have anyone encounter
this problem or know what I need to do to fix it?

Any help will be appreciated.

Thanks,

Alberto Acevedo
Computer  Engineer
US Army CERDEC SED/ABSD
Fort Monmouth , New Jersey
(732) 532-6191

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: ibatis.net & sqlserver2005 & provider not loading

Mark.Gillen

Alberto,

You might check your SQLMap.config (or DAO.config if your using the Data Access interfaces) and make sure your <database><provider> is set "sqlServer2005".

Also make sure the providers.config file that you edited is in fact the one in you bin / debug or  / release directory i.e. the file can be loaded by the assembly.

Also do you have the SQL Server 2005 provider installed on your client?  Dumb question probably but never hurts to ask... :))

I believe you can also use the "sqlServer2.0" entry as that entry and the one for 2005 looks to be identical.

I might suggest if you can

Best regards,

Mark Gillen

Assurant Corporate Technology (ACT)
Business & Enterprise Application Services
Miami -T-2, Technology Bldg.

(305) 253-2244 Ext. 32013
[hidden email]



"Acevedo, Alberto Mr CIV USA AMC" <[hidden email]>

02/12/2009 10:40 AM

Please respond to
[hidden email]

To
<[hidden email]>
cc
Subject
ibatis.net & sqlserver2005 & provider not loading






I spent several days trying to fix this problem but no success so far. I
found some solutions in the mailing list but none of them worked. I'm
using iBatis.Net (IBatis.DataMapper.1.6.2), Visual Studio 2005, and SQL
server 2005. The problem is that iBatis can't load the provider. This is
my provider in provider.config:

<provider
    name="sqlServer2005"
    enabled="true"
    description="Microsoft SQL Server, provider V2.0.0.0 in framework
.NET V2.0"
    assemblyName="System.Data, Version=2.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 was able to connect to Access using the provider for an Access
database  but It fails with SQL Server 2005. This is the exact error:
Could not configure providers. Unable to load provider named
\"sqlServer2005"\ not found. Cause: The type initializer for
'System.data.sqlClient.SqlConnection' threw an exception.

I supect it is the version and PublicKeyToken. Have anyone encounter
this problem or know what I need to do to fix it?

Any help will be appreciated.

Thanks,

Alberto Acevedo
Computer  Engineer
US Army CERDEC SED/ABSD
Fort Monmouth , New Jersey
(732) 532-6191



This e-mail message and all attachments transmitted with it may contain legally privileged and/or confidential information intended solely for the use of the addressee(s). If the reader of this message is not the intended recipient, you are hereby notified that any reading, dissemination, distribution, copying, forwarding or other use of this message or its attachments is strictly prohibited. If you have received this message in error, please notify the sender immediately and delete this message and all copies and backups thereof.

Thank you.


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

RE: ibatis.net & sqlserver2005 & provider not loading

alberto.acevedo
Mark,

I just found the problem. It was a bad configuration in the app.config.
I removed the bad configuration and iBatis was able to connect to SQL
Server 2005.

Thanks very much for your help,


Alberto Acevedo
Computer  Engineer
US Army CERDEC SED/ABSD
Fort Monmouth , New Jersey
(732) 532-6191


-----Original Message-----
From: [hidden email] [mailto:[hidden email]]
Sent: Thursday, February 12, 2009 10:56 AM
To: [hidden email]
Subject: Re: ibatis.net & sqlserver2005 & provider not loading


Alberto,

You might check your SQLMap.config (or DAO.config if your using the Data
Access interfaces) and make sure your <database><provider> is set
"sqlServer2005".

Also make sure the providers.config file that you edited is in fact the
one in you bin / debug or  / release directory i.e. the file can be
loaded by the assembly.

Also do you have the SQL Server 2005 provider installed on your client?
Dumb question probably but never hurts to ask... :))

I believe you can also use the "sqlServer2.0" entry as that entry and
the one for 2005 looks to be identical.

I might suggest if you can

Best regards,

Mark Gillen

Assurant Corporate Technology (ACT)
Business & Enterprise Application Services Miami -T-2, Technology Bldg.

(305) 253-2244 Ext. 32013
[hidden email]



"Acevedo, Alberto Mr CIV USA AMC" <[hidden email]>

02/12/2009 10:40 AM
Please respond to
[hidden email]

To
<[hidden email]>
cc
Subject
ibatis.net & sqlserver2005 & provider not loading

       





I spent several days trying to fix this problem but no success so far. I
found some solutions in the mailing list but none of them worked. I'm
using iBatis.Net (IBatis.DataMapper.1.6.2), Visual Studio 2005, and SQL
server 2005. The problem is that iBatis can't load the provider. This is
my provider in provider.config:

<provider
    name="sqlServer2005"
    enabled="true"
    description="Microsoft SQL Server, provider V2.0.0.0 in framework
.NET V2.0"
    assemblyName="System.Data, Version=2.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 was able to connect to Access using the provider for an Access
database  but It fails with SQL Server 2005. This is the exact error:
Could not configure providers. Unable to load provider named
\"sqlServer2005"\ not found. Cause: The type initializer for
'System.data.sqlClient.SqlConnection' threw an exception.

I supect it is the version and PublicKeyToken. Have anyone encounter
this problem or know what I need to do to fix it?

Any help will be appreciated.

Thanks,

Alberto Acevedo
Computer  Engineer
US Army CERDEC SED/ABSD
Fort Monmouth , New Jersey
(732) 532-6191




________________________________

This e-mail message and all attachments transmitted with it may contain
legally privileged and/or confidential information intended solely for
the use of the addressee(s). If the reader of this message is not the
intended recipient, you are hereby notified that any reading,
dissemination, distribution, copying, forwarding or other use of this
message or its attachments is strictly prohibited. If you have received
this message in error, please notify the sender immediately and delete
this message and all copies and backups thereof.

Thank you.

________________________________


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

RE: ibatis.net & sqlserver2005 & provider not loading

dhavalkapasi
Alberto, I am having the similar issue but am not being able to figure out the bad configuration.

What configuration did you change in app.config to resolve this issue? Appreciate any help.

Thanks.
Dhaval
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

RE: ibatis.net & sqlserver2005 & provider not loading

alberto.acevedo
Dhaval,

In my app.config I commented out the appSettings, configSections, iBatis  tags. The only tag I'm using is the connectionString tag. I think some of these tags were outdated or incorrectly set for the version of ibatis I'm using.

Make sure you have the correct build action for your configuration files like the providers.config. In my case I have the providers.config set to embedded resource. Most of the time the problem with the iBatis configuration is the buid action.

I hope these  hints fix your problem. If not , send my a reply and I will help you out.

Regards,

Alberto Acevedo

dhavalkapasi wrote
Alberto, I am having the similar issue but am not being able to figure out the bad configuration.

What configuration did you change in app.config to resolve this issue? Appreciate any help.

Thanks.
Dhaval
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

RE: ibatis.net & sqlserver2005 & provider not loading

dhavalkapasi
Alberto,

Thanks for your response. Finally, we found the issue. We were getting the error because there was a providers.config file in Windows System 32 folder. Not sure how it got there but IBatis will use the file in Windows System32 folder first if present. Hence it was not looking at the provider.config file in my application folder. After I deleted the file in System32 folder, the problem is resolved.

Dhaval
Loading...