- Home /
Can't Connect to SQLite after Build.....
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
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.
Just now I worked it out finally!
Since I'm using a Chinese version SQL Server 2008, I need a I18N.CJ$$anonymous$$.dll(China,Japan,$$anonymous$$orea) besides I18N.West.dll and I18N.dll under Assets folder. It works well now. Wish it could help for you. Just add a I18N.your country.dll will help.
Answer by Meltdown · Dec 05, 2012 at 11:04 AM
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.
Answer by Oksana Iashchuk · Dec 14, 2012 at 06:01 PM
SQLiteKit asset could help you to manage your SQLite3 database even on web! That library has examples how to run it.
Answer by GamerUnity · Apr 24, 2011 at 10:01 PM
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 :)
Your answer
Follow this Question
Related Questions
Distribute terrain in zones 3 Answers
Hiding the SQLite file 0 Answers
Sparse octree in Sqlite? 0 Answers
Looking for step-by-step manual how to configure SQL Lite on Unity 2017 ( or other database) 1 Answer
Errors from sqlite 0 Answers