does direct SQL connection with Unity work in Android?
Hello everyone, I know i should have to use webserver, php, etc to connect to a database. That's another issue and not relevant to this one. This is about connecting to a SQL datebase with android build. Not SQL lite. When i run my app from editor via a simulator, all works fine. But when i build it to an android device the connection functions stop working. SqlConnection connection = new SqlConnection(conString);
try
{
string uname = username_R.text.Trim();
connection.Open();
SqlCommand check_User_Name = new SqlCommand("SELECT * FROM userinfo WHERE ([username] = @username)", connection);
check_User_Name.Parameters.AddWithValue("@username", uname);
SqlDataReader reader = check_User_Name.ExecuteReader();
if (reader.HasRows)
{
Debug.Log("1122");
}
else
{
AddUser();
}
}
catch (SqlException)
{
Debug.Log("error");
}
finally
{
connection.Close();
}
this piece of function is fully functional in editor. But I do not know what causes this; if i should have to import some Dll's or unity or android doesnt let me to connect to a database directly. When i pressed the register button in adroid device, it should fire this piece of code as it does in editor but it seems it ignores or skips the sql connection parts. The device is connecting to a remote server and recieves the encrypted connection string from server, decrypts it and assigns to proper value. All works fine about connection string, so it is not about connection string. As i mentioned above everything works fine in editor. Any ideas what causes this or how to solve it? Thanks...
Ps: It is not about SQL lite and i know that i should have to use webserver, php or etc to connect to database.
Your answer
Follow this Question
Related Questions
SQL Connection security (Android) 1 Answer
Connecting unity to SQL 1 Answer
MSSQL 2014 Connection and Socket Exception 1 Answer
Unity Remote 5 Not Connecting 3 Answers
No GearVR in My app, But it always start GearVR when I start my app! 0 Answers