I am connecting to a MySql database (5.0.77) via the MySql.data.dll(version 5.1.6 or 5.2.7). I am able to open a connection to the database when I run my game in the editor. However, when I create a build (either webplayer or windows standalone) it is not able to open the connection and it dies with the following error/stack trace.
I have checked to see if the dll’s (MySql.Data.dll and System.data.dll) included in the standalone build are the same version as those included in unity, and they are. I have also made sure that these two dll’s are included in a subfolder of the projects Assets directory.
This occurs on both unity 2.5 and 2.6.
How can I solve this problem and get the connection to mysql database to open via a standalone or webplayer build?
Your best bet is to talk to an intermediary via the WWW class (some server-side script that does the actual communication with the database). This is more compatible–you can deploy to the web player–and also more secure.
As suggested by anomalous_underdog, the solution to this problem is to add the I18N.dll and the I18N.West.dll to the assets folder of unity (I grabbed these from the Mono.Framework folder in unity). This will cause these two dll’s to be included in the Standalone build, and connects can then be opened to the database.