Search Unity

System.Data.SQLite: DllNotFoundException

Discussion in 'Multiplayer' started by GreenStone, Jun 10, 2012.

  1. GreenStone

    GreenStone

    Joined:
    Mar 19, 2012
    Posts:
    9
    Hi, everyone

    I am using the Indie version of Unity and right now I need to set up a communication with a DB. I want to use sqlite as they provide the .NET version for x64.
    Unfortunately, I am having the "DllNotFoundException"-issue. I checked the forums and the internet and here is what I tried to do:

    First I searched for System.Data.dll in the Unity folder (found it in Editor\Data\Mono\lib\mono\unity)

    1) Put System.Data.dll, System.Data.SQLite and sqlite3 in the assets folder (Assets/ExternalLibraries)
    2) Put System.Data.dll, System.Data.SQLite and sqlite3 in the root folder of the project
    3) Put System.Data.dll, System.Data.SQLite and sqlite3 in the Unity/Editor folder (installation folder)
    4) Put System.Data.dll, System.Data.SQLite and sqlite3 in the plugins folder (Assets/Plugins)

    So far nothing has changed and the error is still there.

    I really hope you can help me. I will need a database as a lot of different data will need to be stored and analyzed

    GreenStone

    Btw, the Unity version is 3.4.2f3
     
  2. UnityCoder

    UnityCoder

    Joined:
    Dec 8, 2011
    Posts:
    534
    For communicate with sqlite DB u required below references in ur code:

    using System.IO;
    using System.Data;
    using Mono.Data.SqliteClient;

    and u have to change in Edit>>Project settings>>player setting : Optimization : API Compitability Level to .Net 2.0.
     
  3. GreenStone

    GreenStone

    Joined:
    Mar 19, 2012
    Posts:
    9
    Yeap, I changed to Mono.Data.Sqlite now and it works fine. Thanks!
     
  4. arvin

    arvin

    Joined:
    Jun 11, 2012
    Posts:
    1
    I have the same problem, I used sqlite on android platform, I met the problem is:When used sqlite in Unity3D's editor, It can work normally,
    but when I build an .apk and put it on my phone, sqlite can not work .. the log is DllNotFoundException: sqlite3....Do you know how to solve it? Thanks
    the dll is Mono.Data.Sqlite.dll and Mono.Data.SqliteClient.dll, mybe it muse be Mono.Data.SqliteClient.so?
     
  5. cpw1986913

    cpw1986913

    Joined:
    Jul 30, 2012
    Posts:
    4
    you should use Mono.Data.Sqlite.dll .After you have builded your project,you must copy sqlite3.dll to the exported project directory(maye be in plugins or other folders).you can find sqlite3.dll in your untiy3d installed directory.
     
  6. eskimojoe

    eskimojoe

    Joined:
    Jun 4, 2012
    Posts:
    1,440
    Did you try using the x86 edition instead of the x64 edition?
     
  7. nishakk94

    nishakk94

    Joined:
    Sep 3, 2017
    Posts:
    2

    I am facing the same problem. How did you solve this?