- Home /
error connecting to my sql
hi i have written the following code
using UnityEngine; using MySql.Data.MySqlClient; using System; using System.Data; using System.Collections.Generic;
public class newSQLscript: MonoBehaviour {
private static MySqlConnection dbConnection;
public void Start () {
string connectionString = "left out for security reason" ;
dbConnection = new MySqlConnection(connectionString); dbConnection.Open(); Debug.Log("Connected to database.");
//closeSqlConnection();
}
and it runs in the editor, however when i build and run it on iphone i get the following error:
Error building Player: SystemException: System.Net.Sockets are supported only on Unity iPhone Advanced. Referenced from assembly 'Mono.Data.Tds'. UnityEditor.BuildPlayerWindow:BuildPlayerAndRun(
I also the bug appear!!
I guess SqliteConnection is also use SystemException: System.Net.Sockets. And, I use Indies Unity
But, Unity Indies allow System.Net.Sockets.
Answer by Bunny83 · Aug 30, 2012 at 01:18 PM
The answer is pretty simple: Unity iPhone Basic doesn't support Sockets as you can see on the license comparison page. It's in the "code" section. So this is not a bug, it's a feature (which you haven't bought).
Answer by softocean · Sep 21, 2012 at 10:12 PM
I'm using sqlite instead of mysql for my ios project. That way I don't have any references to net.sockets. Checkout this link for more info: blog post by Poya Manouchehri I also had to remove all scripts using mysql from my project for the build.