- Home /
MySQL and Unity android build
Hi guys,
My company making an app for android and iOS and I need to make connection to mySQL for now and I read a lot of posts and I import MySQL.Data.dll and System.Data to Assets folder and make a script but I can't build it for android.
I get
Error building Player: SystemException: 'System.Net.Sockets' are supported only with Unity Android Pro. Referenced from assembly 'Mono.Data.Tds'.
Is there any chance to get working build for android and iOS with mySQL dll?
"Unity Android Pro" you probably don't have the proper licensing.
I believe you could make a PHP data connection first, then transfer variables via POST, JSON or other methods and save them in mySQL.
Yes I know, but mySQL is just for now to test, because in 2 months we'll change mySQL to mongo
Answer by h8crew · Aug 22, 2013 at 02:06 PM
Make a WWW request to a PHP script (passing it variables via the URL) hosted on a remote server where the database exists. Make the PHP script return a string and parse it in Unity.
I will try it later, now I just wanna connect to database but I got this error
ArgumentException: Format of initialization string does not conform to specifications at index 90.
$$anonymous$$y connection string:
server = "localhost";
database = "test_1";
uid = "test_1";
password = "dfe#4fd._@";
string connectionString;
connectionString = "SERVER=" + server + ";" + "DATABASE=" +
database + ";" + "UID=" + uid + ";" + "PASSWORD=" + password + ";";
Your connection string is only 65 characters long, so if there's an error at index 90 the only two reasons are:
This is not the connection string you use when you open the connection
You alter the string before you pass it to the DB.
Btw: There are 1001 ways to connect to a $$anonymous$$ySQL database, what exact DLL / driver are you using? Where have you found it?
Im using $$anonymous$$ySqlData.dll Im download it yesterday from official page.
Answer by elgameshdpay · Oct 16, 2017 at 08:17 PM
any solution?
I would downvote multiple times if it was possible:
You just woke up a four years old question which is completely obsolete now as Unity doesn't have this restriction anymore since at least Unity 5.6 i think.
You most likely don't have the exact same problem as the OP. So if you have a similar question, ask a seperate question and do not try to hijack other peoples questions.
You posted an answer without answering the question.
Bumping threads without adding anything new is a bad habit.
There is already an answer that presented a solution (to use WWW and a PHP interface on your server). However as the Socket restriction doesn't apply anymore you should be able to juse use the normal $$anonymous$$ySQL connector. Though it's never recommended to directly connect to a $$anonymous$$ySQL server. In almost all cases you want to communicate through a PHP or similar interface.