11/22/2023 0 Comments Login sqlite mac![]() Use Application.streamingAssetsPath for that. Looked at the code and found few problems but I can't tell if those are the reason you are getting this error. Most tutorials on this topic are outdated. I have also added my database to the 'StreamingAssets' folder as shown in the image below:īelow also shows an image of my plugins folder that holds my dll files. UnityEngine.SetupCoroutine:InvokeMoveNext(IEnumerator, IntPtr)Ġ6-08 15:26:56.502 16300-16315/? E/Unity: ArgumentException: Invalid ConnectionString format for parameter "URI"Īt UIHandler.CreateIndiButton () in :0 UnityEngine.MonoBehaviour:StartCoroutine(IEnumerator) However, I am still getting the following errors: 06-08 15:26:56.498 16300-16315/? E/Unity: ArgumentException: Invalid ConnectionString format for parameter "/storage/emulated/0/Android/data/_project/files/data/TBLDatabase.db"Īt UIHandler+c_Iterator3.MoveNext () in :0 Sql = "INSERT INTO existing_individual (studentID, fullName, studentNumber) VALUES jsonIndiStudentNumbers) ![]() looping through the existing students registered for the individual quiz - below has been written to avoid SQL injection Inserting the exisiting student names returned, into the SQLite DBįoreach (var individuals in jsonStudentID) Var sql = "CREATE TABLE existing_individual (studentID VARCHAR(23), fullName VARCHAR(50), studentNumber VARCHAR(20))" Var connection = new SqliteConnection(dbDestination) Ĭommand.CommandText = "DROP TABLE IF EXISTS existing_individual " Copy the data to the persistentDataPath where the database API can freely access the fileįile.WriteAllBytes(dbDestination, result) If (!Directory.Exists(Path.GetDirectoryName(dbDestination)))ĭirectory.CreateDirectory(Path.GetDirectoryName(dbDestination)) ![]() Result = File.ReadAllBytes(dbStreamingAsset) If (dbStreamingAsset.Contains("://") || dbStreamingAsset.Contains(":///")) String dbStreamingAsset = Path.Combine(Application.streamingAssetsPath, fileName) Check if the File do not exist then copy it String dbDestination = Path.Combine(Application.persistentDataPath, "data") ĭbDestination = Path.Combine(dbDestination, fileName) Then I have the following method: IEnumerator RunDbCode(string fileName, List jsonStudentID, List jsonIndiNames, List jsonIndiStudentNumbers) I am now calling the following method to start my connection and handle DB requests StartCoroutine(RunDbCode(dbFileName, jsonStudentID, jsonIndiNames, jsonIndiStudentNumbers)) I have since made the following alterations based on advice given. I believe I have all the relevant dll files, but if anyone could give me some guidance I would appreciate it. I have used adb shell and pulled the DB from my Android device and everything is as expected (the DB does exist and it isn't empty). Var command = connection.CreateCommand() Var connection = new SqliteConnection(tblDatabase) then save to Application.persistentDataPathįile.WriteAllBytes(tblDatabase, tes) While (!loadDb.isDone) // CAREFUL here, for safety reasons you shouldn't let this while loop unattended, place a timer and error check Var loadDb = new // this is the path to your StreamingAssets in android open StreamingAssets directory and load the db -> Attempting to create from \"" + Application.dataPath + "!/assets/" + "TBLDatabase.db") TblDatabase = Application.persistentDataPath + "/TBLDatabase.db" ĭebug.LogWarning("File \"" + tblDatabase + "\" does not exist. TblDatabase = "URI=file:" + Application.dataPath + "/TBLDatabase.db" //returns the complete path to database file exist. ![]() This is what I have so far: if (atform != RuntimePlatform.Android) I thought that making an amendment to the connectionString should be simple enough, but that hasn't solved my problem. E/Unity: ArgumentException: Invalid ConnectionString format for parameter "/storage/emulated/0/Android/data/_project/files/TBLDatabase.db"Īt .ParseConnectionString (System.String connectionString) in :0Īt .Open () in :0Īt UIHandler+c_Iterator2.MoveNext () in :0Īt (IEnumerator enumerator, IntPtr returnValueAddress) in :0 When testing on an Android device, I get the following errors. I am trying to include in my project an SQLite DB, and when building for PC, MAC & Linux Standalone (testing on a Windows machine), the database works as expected. However, they have not helped to solve my problem. I have looked at too many tutorials to list and they all recommend the same thing.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |