Java Mailing List Archive

Home » the NHibernate development list »

[NHibernate-development] MySqlDataDriver: Using
DbProviderFactories.GetFactory instead of Reflection?



Replies: Find Java Web Hosting

Author LoginPost Reply

please excuse me if this is the wrong place to post this.. it's more of
a development question than a usage question so I thought this would be
the right place. I haven't seen this being discussed anywhere yet.

The problem:
NHibernate doesn't find the MySql.Data.dll unless it is either copied to
the application directory or the app.config has been correctly
configured to redirect requests to the GAC.
The exception's message is: "Could not create the driver from
A user posted the same problem in the forums:

I had a quick look at the class MySqlDataDriver and saw that it uses
reflection to load the MySql.Data.dll and to create instances of the
connection and command types. That explains the problem.

I was wondering why it doesn't (additionally) try to do this using ADO's
DbProviderFactories.GetFactory() method? A DbProviderFactory has methods
for creating connection and command instances.

This way MySql.Data.dll wouldn't have to be copied to the application
directory and no additional app.config changes would be necessary.

Please let me know what you think of that.


Sponsored by: Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source project,
along with a healthy diet, reduces your potential for chronic lameness
and boredom. Vote Now at
Nhibernate-development mailing list
©2008 - Jax Systems, LLC, U.S.A.