You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-cs@ibatis.apache.org by Rick Reumann <ri...@gmail.com> on 2006/03/25 19:07:46 UTC

Problem trying to declare a Sybase provider

I'm going to need to access Sybase through my winforms application. I'd like
to use ibatis.net if possible. I can connect fine with the mono Sybase
driver that I'm using when I connect manually with standard C# code as shown
on this mono page: http://www.mono-project.com/Sybase

The problem I'm running into is in trying to declare the provider. The error
I'm getting is listed below. It looks like it's a problem trying to load
Mono.Data.SybaseCommand. Here is a link showing all the classes in the
Mono.Data.Sybase dll:   http://www.pastehere.com/?bmirfk  which shows a
SybaseCommand class so I'm a bit stumped as to the problem.

thanks for any help.

IBatisNet.Common.Exceptions.ConfigurationException:
- The error occurred while loading Providers.
- initialize provider
- Check the SybaseMono. 'TestIbatis.vshost.exe' (Managed): Loaded
'C:\dotnet\TestIbatis\TestIbatis\bin\Debug\Mono.Data.SybaseClient.dll', No
symbols loaded.
A first chance exception of type '
IBatisNet.Common.Exceptions.ConfigurationException' occurred in
IBatisNet.DataMapper.dll
---> IBatisNet.Common.Exceptions.ConfigurationException: Could not configure
providers. Unable to load provider named "SybaseMono" not found, failed.
Cause: Could not load type 'Mono.Data.SybaseCommand' from assembly '
Mono.Data.SybaseClient, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=0738eb9f132ed756'. ---> System.TypeLoadException: Could not
load type 'Mono.Data.SybaseCommand' from assembly 'Mono.Data.SybaseClient,
Version=2.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756'.
   at System.Reflection.Assembly.GetType(String name, Boolean throwOnError,
Boolean ignoreCase)
   at System.Reflection.Assembly.GetType(String name, Boolean throwOnError)
   at IBatisNet.Common.Provider.Initialize()
   --- End of inner exception stack trace ---
   at IBatisNet.Common.Provider.Initialize()
   at IBatisNet.DataMapper.Configuration.DomSqlMapBuilder.GetProviders()
   at IBatisNet.DataMapper.Configuration.DomSqlMapBuilder.Initialize()
   at IBatisNet.DataMapper.Configuration.DomSqlMapBuilder.Build(XmlDocument
document, DataSource dataSource, Boolean useConfigFileWatcher, Boolean
isCallFromDao)
   --- End of inner exception stack trace ---
   at IBatisNet.DataMapper.Configuration.DomSqlMapBuilder.Build(XmlDocument
document, DataSource dataSource, Boolean useConfigFileWatcher, Boolean
isCallFromDao)
   at IBatisNet.DataMapper.Configuration.DomSqlMapBuilder.Build(XmlDocument
document, Boolean useConfigFileWatcher)
   at IBatisNet.DataMapper.Configuration.DomSqlMapBuilder.ConfigureAndWatch(String
resource, ConfigureHandler configureDelegate)
   at IBatisNet.DataMapper.Configuration.DomSqlMapBuilder.ConfigureAndWatch(ConfigureHandler
configureDelegate)
   at IBatisNet.DataMapper.Mapper.InitMapper()
   at IBatisNet.DataMapper.Mapper.Instance()
   at TestIbatis.Form1.button1_Click(Object sender, EventArgs e) in
C:\dotnet\TestIbatis\TestIbatis\Form1.cs:line 49

--
Rick

Re: Problem trying to declare a Sybase provider

Posted by Rick Reumann <ri...@gmail.com>.
On 3/25/06, Ron Grabowski <ro...@yahoo.com> wrote:
>
> Could you post the Sybase provider entry from your providers.config.
> IBatisNet is basically doing this:
>
> Type sybaseCommandType = Type.GetType("Mono.Data.SybaseCommand,
> Mono.Data.SybaseClient, Version=2.0.0.0,
> Culture=neutral,PublicKeyToken=0738eb9f132ed756");
> IDbCommand command =
> (IDbCommand)Activator.CreateInstance(sybaseCommandType);
>
> Are you able to use Reflector to verify that the assembly name you're
> using for SybaseClient is correct? Try this omitting the Version,
> Culture, etc. information:
>
> Type sybaseCommandType =
> Type.GetType("Mono.Data.SybaseCommand, Mono.Data.SybaseClient");
> IDbCommand command =
> (IDbCommand)Activator.CreateInstance(sybaseCommandType);



I'm pretty sure I have the version info correct. Here is what Reflector
shows:
http://www.pastehere.com/?gwglsq

Here is what I have for the provider setup:

<provider
        name="SybaseMono"
        enabled="true"
        assemblyName="Mono.Data.SybaseClient, Version=2.0.0.0,
Culture=neutral, PublicKeyToken=0738eb9f132ed756"
        connectionClass="Mono.Data.SybaseConnection"
        commandClass="Mono.Data.SybaseCommand"
        parameterClass="Mono.Data.SybaseParameter"
        parameterDbTypeClass="Mono.Data.SybaseType"
        parameterDbTypeProperty="SybaseType"
        dataAdapterClass="Mono.Data.SybaseDataAdapter"
        commandBuilderClass="Mono.Data.SybaseCommandBuilder"
        usePositionalParameters = "false"
        useParameterPrefixInSql = "true"
        useParameterPrefixInParameter = "false"
        parameterPrefix=""
    />

Again, I'm not sure about the last four parameters. I just guessed at them
to start with. (I  think I copied the Oledb one... I probably will need to
find out what the parameterPrefix is).

When I try just:

Type sybaseCommandType = Type.GetType("Mono.Data.SybaseCommand,
Mono.Data.SybaseClient");
                 IDbCommand command =
(IDbCommand)Activator.CreateInstance(sybaseCommandType);

I get the following (which might be ok? I'm not sure what to expect)...

System.ArgumentNullException: Value cannot be null.
Parameter name: type
   at System.Activator.CreateInstance(Type type, Boolean nonPublic)
   at System.Activator.CreateInstance(Type type)
   at TestIbatis.Form1.button1_Click(Object sender, EventArgs e) in
C:\dotnet\TestIbatis\TestIbatis\Form1.cs:line 55
A first chance exception of type 'System.ArgumentNullException' occurred in
mscorlib.dll

I even tried then to change the providers.config to be set to just
assemblyName="Mono.Data.SybaseClient"

but that still got me the same initial error:

IBatisNet.Common.Exceptions.ConfigurationException:
- The error occurred while loading Providers.
- initialize provider
- Check the SybaseMono. --->
IBatisNet.Common.Exceptions.ConfigurationException: Could not configure
providers. Unable to load provider named "SybaseMono" not found, failed.
Cause: Could not load type 'Mono.Data.SybaseCommand' from assembly '
Mono.Data.SybaseClient, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=0738eb9f132ed756'. ---> System.TypeLoadException: Could not
load type 'Mono.Data.SybaseCommand' from assembly 'Mono.Data.SybaseClient,
Version=2.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756'.
   at System.Reflection.Assembly.GetType(String name, Boolean throwOnError,
Boolean ignoreCase)
   at System.Reflection.Assembly.GetType(String name, Boolean throwOnError)
   at IBatisNet.Common.Provider.Initialize()


If you want to check out the dll that I'm using I put it here:
http://www.reumann.net/misc/Mono.Data.SybaseClient.dll


Thanks again for trying to help me figure this out.

Re: Problem trying to declare a Sybase provider

Posted by Ron Grabowski <ro...@yahoo.com>.
Could you post the Sybase provider entry from your providers.config.
IBatisNet is basically doing this:

Type sybaseCommandType = Type.GetType("Mono.Data.SybaseCommand,
Mono.Data.SybaseClient, Version=2.0.0.0,
Culture=neutral,PublicKeyToken=0738eb9f132ed756");
IDbCommand command = 
 (IDbCommand)Activator.CreateInstance(sybaseCommandType);

Are you able to use Reflector to verify that the assembly name you're
using for SybaseClient is correct? Try this omitting the Version,
Culture, etc. information:

Type sybaseCommandType = 
 Type.GetType("Mono.Data.SybaseCommand, Mono.Data.SybaseClient");
IDbCommand command = 
 (IDbCommand)Activator.CreateInstance(sybaseCommandType);

--- Rick Reumann <ri...@gmail.com> wrote:

> I'm going to need to access Sybase through my winforms application.
> I'd like
> to use ibatis.net if possible. I can connect fine with the mono
> Sybase
> driver that I'm using when I connect manually with standard C# code
> as shown
> on this mono page: http://www.mono-project.com/Sybase
> 
> The problem I'm running into is in trying to declare the provider.
> The error
> I'm getting is listed below. It looks like it's a problem trying to
> load
> Mono.Data.SybaseCommand. Here is a link showing all the classes in
> the
> Mono.Data.Sybase dll:   http://www.pastehere.com/?bmirfk  which shows
> a
> SybaseCommand class so I'm a bit stumped as to the problem.
> 
> thanks for any help.
> 
> IBatisNet.Common.Exceptions.ConfigurationException:
> - The error occurred while loading Providers.
> - initialize provider
> - Check the SybaseMono. 'TestIbatis.vshost.exe' (Managed): Loaded
>
'C:\dotnet\TestIbatis\TestIbatis\bin\Debug\Mono.Data.SybaseClient.dll',
> No
> symbols loaded.
> A first chance exception of type '
> IBatisNet.Common.Exceptions.ConfigurationException' occurred in
> IBatisNet.DataMapper.dll
> ---> IBatisNet.Common.Exceptions.ConfigurationException: Could not
> configure
> providers. Unable to load provider named "SybaseMono" not found,
> failed.
> Cause: Could not load type 'Mono.Data.SybaseCommand' from assembly '
> Mono.Data.SybaseClient, Version=2.0.0.0, Culture=neutral,
> PublicKeyToken=0738eb9f132ed756'. ---> System.TypeLoadException:
> Could not
> load type 'Mono.Data.SybaseCommand' from assembly
> 'Mono.Data.SybaseClient,
> Version=2.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756'.
>    at System.Reflection.Assembly.GetType(String name, Boolean
> throwOnError,
> Boolean ignoreCase)
>    at System.Reflection.Assembly.GetType(String name, Boolean
> throwOnError)
>    at IBatisNet.Common.Provider.Initialize()
>    --- End of inner exception stack trace ---
>    at IBatisNet.Common.Provider.Initialize()
>    at
> IBatisNet.DataMapper.Configuration.DomSqlMapBuilder.GetProviders()
>    at
> IBatisNet.DataMapper.Configuration.DomSqlMapBuilder.Initialize()
>    at
> IBatisNet.DataMapper.Configuration.DomSqlMapBuilder.Build(XmlDocument
> document, DataSource dataSource, Boolean useConfigFileWatcher,
> Boolean
> isCallFromDao)
>    --- End of inner exception stack trace ---
>    at
> IBatisNet.DataMapper.Configuration.DomSqlMapBuilder.Build(XmlDocument
> document, DataSource dataSource, Boolean useConfigFileWatcher,
> Boolean
> isCallFromDao)
>    at
> IBatisNet.DataMapper.Configuration.DomSqlMapBuilder.Build(XmlDocument
> document, Boolean useConfigFileWatcher)
>    at
>
IBatisNet.DataMapper.Configuration.DomSqlMapBuilder.ConfigureAndWatch(String
> resource, ConfigureHandler configureDelegate)
>    at
>
IBatisNet.DataMapper.Configuration.DomSqlMapBuilder.ConfigureAndWatch(ConfigureHandler
> configureDelegate)
>    at IBatisNet.DataMapper.Mapper.InitMapper()
>    at IBatisNet.DataMapper.Mapper.Instance()
>    at TestIbatis.Form1.button1_Click(Object sender, EventArgs e) in
> C:\dotnet\TestIbatis\TestIbatis\Form1.cs:line 49
> 
> --
> Rick
>