- Home /
DbLinq and SQLite
Has anyone had any luck getting SQLite to work with DbLinq or just to get DbLinq working in unity? I've spent all day working on this and am really frustrated. I've got compilable code and everything seams right but when I run the app, I get a simple: "No Such Host is Known" error along with 1 other error about System.Net.TCP. I'm assuming DbLinq is trying to access a server instead of the file based sqlite file I have specified. Here is my code I came up with after doing 40 other steps outside of unity just to get this thing up and running:
using UnityEngine;
using System.Collections;
//using System.Data.Linq;
using System.Linq;
using KonCraft.Data;
using DbLinq.Data.Linq;
using DbLinq.Sqlite;
public class DatabaseHelper : MonoBehaviour {
KonCraftDataContext db;
void Start () {
db = new KonCraftDataContext(
"DbLinqProvider=Sqlite;Data Source=gamedata.db"
);
var blocks = (from b in db.TblBlocks
select b);
Debug.Log(blocks.First().BlockName.ToString ());
}
}
rickyhenry
This may help, here is Linq to SQLite. https://www.kellermansoftware.com/p-47-net-data-access-layer.aspx
Answer by nicolasjr · Nov 06, 2015 at 09:59 AM
If you're interested, I've developed a plugin that has all the connections sorted out, for all platforms, and it also makes database integration extremely simple, since it allows you to store and retrieve data without writing queries.
Case you want to check it out, here's the link to the asset store page: