Hello everyone.

We have decided to phase out the Mixed Reality Forums over the next few months in favor of other ways to connect with us.

The first way we want to connect with you is our mixed reality developer program, which you can sign up for at https://aka.ms/IWantMR.

The plan between now and the beginning of May is to clean up old, unanswered questions that are no longer relevant. The forums will remain open and usable.

On May 1st we will be locking the forums to new posts and replies. They will remain available for another three months for the purposes of searching them, and then they will be closed altogether on August 1st.

So, where does that leave our awesome community to ask questions? Well, there are a few places we want to engage with you. For technical questions, please use Stack Overflow, and tag your questions using either hololens or windows-mixed-reality. If you want to join in discussions, please do so in the HoloDevelopers Slack, which you can join by going to https://aka.ms/holodevelopers. And always feel free to hit us up on Twitter @MxdRealityDev.

Is SQLite compatible with HoloLens?

I've been trying to connect an SQLite database to Unity, and while data is retrieved and displayed correctly in Unity, the project won't build at all.
Originally I tried the method in this tutorial:
http://answers.unity3d.com/questions/743400/database-sqlite-setup-for-unity.html

So is HoloLens compatible with SQLite? And if it is, what is the correct way to connect?

Tagged:

Best Answer

Answers

  • @hololent

    Have you tried going the UWP route?
    Haven't tried it myself, and not sure if it works or not, but if it does my hunch is that you would need to use the UWP version of the library.

    Couple of links that might help:

    https://msdn.microsoft.com/en-us/windows/uwp/data-access/sqlite-databases

    https://www.tutorialspoint.com/windows10_development/windows10_development_sqlite_database.htm

    Be sure to wrap any UWP specific code (including Using statements) in the appropriate:

    #if WINDOWS_UWP
    
    #endif
    

    Windows Holographic User Group Redmond

    WinHUGR.org - - - - - - - - - - - - - - - - - - @WinHUGR
    WinHUGR YouTube Channel -- live streamed meetings

  • @HoloSheep Thank you for your response.

    I've had a look at using the UWP way, but the problem is that since I'm using Unity I don't have a UWP project until I have built the solution in Unity. Then once it's built I can add the database connection and a reference to the project the code is in (since it won't seem to work in the scripts that show up in Unity), but then I have the problem of Unity not understanding the reference when I go back.

  • @hololent

    Correct, the UWP database logic will not run in the Unity IDE but if you use the conditional compiler directives that I mentioned the Unity IDE should ignore the UWP calls and not have problems with them.

    Ultimately, the HoloLens runs UWP applications so whatever libraries that you want to use need to be UWP compliant and the Unity SQLite libraries that you tried may not be (just speculation on my part) so that is why I suggested you try the UWP approach.

    Windows Holographic User Group Redmond

    WinHUGR.org - - - - - - - - - - - - - - - - - - @WinHUGR
    WinHUGR YouTube Channel -- live streamed meetings

  • I think you're right, it should be connected the UWP way rather than my original method.

    However it seems as though I can only successfully connect to the database in the built solution from unity, which is then not compatible with Unity to work with the data.

  • edited December 2016

    @hololent: To get what you are trying to do, where you can work with it in both the Unity Editor and on the HoloLens, you will have to use pre-processor directives both ways. Basically, any calls to the Unity way of doing it will need to have the directive for use in unity but ignored by uwp, and vice versa for the UWP code. It's going to be a pain to do, and likely look messy, but it's the only way I know to be able to work with the data in both places.

  • Thanks for the answers everyone, but I'm just going to connect a separate non hololens unity project to my database, and then download as csv files to read into my project. My data isn't changing at this point so it'll work.

    If anyone gets UWP to work though I'd love to know

    :)

  • @Jimbohalo10
    I used the SQLite made easy for Unity3d link that you supplied, and it works! The scripts need tweaking to work for other databases, but nothing too difficult :) Thankyou!

  • AndersAnders
    edited December 2016

    @hololent Great to hear! Just to clarify, are you able to use SQLite in Unity, HoloLens, or both? The project "SQLite made easy for Unity3d" doesn't appear to have any specific DLL:s for HoloLens (x86 UWP)?

    Owner of the startup Information Experience Sweden AB, http://informationexperience.se
    Information Management, SharePoint, CAD, Visualization for AEC. Architecting and developing solutions for HoloLens, combined with AR Toolkit, Kinect, RealSense, Leap Motion.

  • @Anders said:
    @hololent Great to hear! Just to clarify, are you able to use SQLite in Unity, HoloLens, or both? The project "SQLite made easy for Unity3d" doesn't appear to have any specific DLL:s for HoloLens (x86 UWP)?

    Just to clarify that we are talking about the same engine from SQLite Download Page

    Universal Windows Platform sqlite-uwp-3150200.vsix (6.20 MiB) VSIX package for Universal Windows Platform development using Visual Studio 2015.

    The code  SQLite made easy for Unity3d the source is available here

    Seems to have the dll and the ability to BUILD the dll from scratch if need be in the source code

    sqlite-snapshot-201612131847.tar.gz (2.37 MiB) The amalgamation source code, the command-line shell source code, configure/make scripts for Unix , and a Makefile.msc for Windows.

    There is an even cheaper version of Unity Asset store above which could work with Unity player for test development SQLiteKit4Subset for Net 2.0 Subset

    This would appear to interface the Universal Windows Platform sqlite-uwp-3150200.vsix package and https://github.com/praeclarum/sqlite-net then could link back into Unity therefore creating the WSAPlayer that may be needed. The code in Unity connect via the Net and there are NuGet packages to attach to you project if needed

    Personally the job of rebuilding from source seems hard as this as already been done for many platforms

  • @Anders
    I'm able to use it in both unity and hololens. It's able to work with UWP applications and unity, which was the problem I needed to overcome to be able to build my unity application for the hololens.

Sign In or Register to comment.