Search Unity

Build does not access the SQLite database

Discussion in 'Editor & General Support' started by AdrianNeata, Mar 1, 2017.

  1. AdrianNeata

    AdrianNeata

    Joined:
    Oct 4, 2016
    Posts:
    5
    Now, I know this is a recurring thread in the forums, but I've read most of the threads about it and tried the methods other people have used and none worked. In the editor it works perfectly, but for some reason it doesn't work once built.
    I have a folder called Plugins in which I put the .DLL files found in Unity/Editor/Data/Mono/lib/mono/unity (I thought maybe it's missing one of them, but that was not the case) and also the .DLL for SQLite. I also have a folder called StreamingAssets where I put my database. To access the database I use this code:

    var connection = new SqliteConnection("Data Source = " + Application.streamingAssetsPath + "/Questions.db");

    I built my program using both types of architecture (x86 and x86_64) to see whether one of them works, but neither did. I checked the _Data folder after the build and the Plugins and StreamingAssets folders were there.
    If you could help me, I would be really grateful.
     
    Last edited: Mar 2, 2017
  2. sudeshna1509

    sudeshna1509

    Joined:
    Jan 25, 2017
    Posts:
    21
    I had faced the same problem few days back when my project was working fine in the editor but was creating problem at the time of build. Here, I guess you want to store/retrieve data to/from some database. In my case, I had to store user input somewhere. Try using csv files. It does not require any additional packages and works just fine.
     
  3. AdrianNeata

    AdrianNeata

    Joined:
    Oct 4, 2016
    Posts:
    5
    Your idea might work but I have no experience with csv files and honestly I am more interested in finding out what am I doing wrong. Since I've first posted this thread, I've tried even more methods to fix it and still can't figure out what is going on. BTW sorry for answering so late :( but I have been busy with school.
     
  4. SolEagle

    SolEagle

    Joined:
    Jan 10, 2017
    Posts:
    1
    Hey, not sure if you're still dealing with this, but for anyone reading this, i've been dealing with the SQlite DB issues myself.
    First, check this file in your folder called like [build_name]_Data. Mine was just called test1_Data.
    Read through the output_log.txt file. It'll show what problem the build had with loading the Sqlite DB

    Mine first told me that it was cause i deployed to 32-bit, when i had 64-bit sqlite dlls loaded. Changed build to x86_64 and it worked.