- Home /
 
DataBase creation on android via unity
I created a sqlite database from unity to run it on android, so I used Apllicantion.persistantDataPath as the path. On pc it works very well, I can create, add, delete and modify data. But in the device it does not work, and I didnt got any error. public void openDB(string p) { connection = "URI=file:" + Application.persistentDataPath + "/" + p; Debug.Log(connection);
             dbconn = new SqliteConnection(connection);
             dbconn.Open();
             dbcmd = dbconn.CreateCommand();
         }
 
         public void closeDB()
         {
             dbcmd.Dispose();
             dbcmd = null;
             dbconn.Close();
             dbconn = null;
         }
 
         public void saveData(string desc, int age, string wants) {
             
             dbconn = (IDbConnection)new SqliteConnection(connection);
             
             string sqlQuery = "INSERT INTO Dados (Descricao, Idade, Interesses) VALUES ('" + desc +"',"+ age + ",'" + wants + "')";
             dbcmd.CommandText = sqlQuery;
             dbcmd.ExecuteNonQuery();
         }
 
              Answer by Bunny83 · Apr 15, 2016 at 05:01 AM
Well your URI is actually wrong. The file URI scheme requires two slashes after the colon like most other protocol schemes. On most platforms you also need to specify a target host, though this is usually handled by the initial slash in a Unix path. Since you print your connection string is should contain three slashes after file:
I'm not sure which connection method you use, but usually you should be able to actually use a file path and not needing to use an URI.
Your answer
 
             Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers
SQlite for Universal Windows Plataform. How to do it? 0 Answers
Remote database for leaderboard 2 Answers
Which Database Should i use?,How i can use database? 1 Answer