Can't Connect to SQLite after Build..... (18399)

I have problem about between SQLite and Unity.. look below:

In Unity Editor (Working)

After Build, Unity Web player (Not Work)

I tested on HTTP and localhost and root folder...

Why its not showing up in webplayer after build? Did i miss something? or something wrong with DLL file? :confused: and my script look below:

here script:

using UnityEngine;
using Mono.Data.SqliteClient;
using System;
using System.Data;
using System.Collections;
using System.Collections.Generic;

public class SQLiteServer : MonoBehaviour {

    private static IDbConnection dbcmd;

    private D jsScript;

    // Use this for initialization
    void Start () {
        jsScript = GameObject.Find("GUI Text").GetComponent<D>(); //Debug mode

        string connectionString = "URI="+ Application.dataPath + "/test.db"; // directory for MAC

        jsScript.msg = "Prepare Connect...";

        IDbConnection conn;

        conn = new SqliteConnection(connectionString);

        jsScript.msg = "Prepare Connect 2..."; //Stuck in Webplayer

        conn.Open();

        print("Connection: " + conn.State);
        jsScript.msg = "Connection: " + conn.State; //No Show... 

        IDbCommand dbcmd = conn.CreateCommand();

I did put DLL to ../Assets/Libraries/:

  • I18N.dll
  • I18N.West.dll
  • Mono.Data.SqliteClient.dll
  • sqlite3.dll System.Configuration.dll
  • System.Data.dll System.Drawing.dll
  • System.EnterpriseServices.dll
  • System.Security.dll

<p>I'm using SQL Server as the database, and I have exactly the same problem. It has kept bothering me for long. If you have sloved it, let me know, please.</p>

3 Answers

3

The web player doesn’t allow local file access.
Thus a SQLLite database will never open if accessed through a web player.

It’s a security restriction of the web player. You’ll need to store your data in PlayerPrefs or via a web service.

SQLiteKit asset could help you to manage your SQLite3 database even on web!
That library has examples how to run it.

interesting

HI for the Sqlite problem it seems to be that you must add SQlite3 this is the driver put it youProjectName/ and evrey thing will be all right :)