Unity3D Android SQLite 사용하기

http://westwoodforever.blogspot.kr/2013/11/c-sqlite-systemdatasqlite.html

System.Data.SQLite




Internal compiler error. See the console log for more information. output was:
Unhandled Exception: System.Reflection.ReflectionTypeLoadException: The classes in the module cannot be loaded.

  at (wrapper managed-to-native) System.Reflection.Assembly:GetTypes (bool)

  at System.Reflection.Assembly.GetTypes () [0x00000] in <filename unknown>:0

  at Mono.CSharp.RootNamespace.ComputeNamespaces (System.Reflection.Assembly assembly, System.Type extensionType) [0x00000] in <filename unknown>:0

  at Mono.CSharp.RootNamespace.ComputeNamespace (Mono.CSharp.CompilerContext ctx, System.Type extensionType) [0x00000] in <filename unknown>:0

  at Mono.CSharp.GlobalRootNamespace.ComputeNamespaces (Mono.CSharp.CompilerContext ctx) [0x00000] in <filename unknown>:0

  at Mono.CSharp.Driver.LoadReferences () [0x00000] in <filename unknown>:0

  at Mono.CSharp.Driver.Compile () [0x00000] in <filename unknown>:0

  at Mono.CSharp.Driver.Main (System.String[] args) [0x00000] in <filename unknown>:0




DllNotFoundException: System.Data.SQLite.dll
System.Data.SQLite.SQLite3.StaticIsInitialized ()
System.Data.SQLite.SQLiteLog.Initialize ()
System.Data.SQLite.SQLiteConnection..ctor (System.String connectionString, Boolean parseViaFramework)
System.Data.SQLite.SQLiteConnection..ctor (System.String connectionString)
(wrapper remoting-invoke-with-check) System.Data.SQLite.SQLiteConnection:.ctor (string)
TestGUI.OnGUI () (at Assets/TestGUI.cs:41)

 유니티에서는 sqlite-netFx20-setup-bundle-x86-2005-1.0.89.0.exe 버전을 설치해서 Assets에 복사하면 빌드는 되지만 런타임에 위와 같은 에러가 나와 사용할 수 없네요. Mono.Data.Sqlite를 사용한다는데 다른 포스팅에서 정리해 보겠습니다.






using Mono.Data.Sqlite;


void Start()
{
string strConn = @"Data Source=D:\testdb.db";

    using (SqliteConnection conn = new SqliteConnection(strConn))
    {
        conn.Open();
     
        string strSQL = "CREATE TABLE member (name string)";
        SqliteCommand sqlcmd = new SqliteCommand(strSQL, conn);
        sqlcmd.ExecuteNonQuery();
        sqlcmd.Dispose();

        strSQL = "INSERT INTO member VALUES ('WestwoodForever SQLite C# Sample.')";
        sqlcmd = new SqliteCommand(strSQL, conn);
        sqlcmd.ExecuteNonQuery();
        sqlcmd.Dispose();

        strSQL = "SELECT * FROM member";
        sqlcmd = new SqliteCommand(strSQL, conn);
        SqliteDataReader rd = sqlcmd.ExecuteReader();
        sqlcmd.Dispose();
        while (rd.Read())
        {
            Debug.Log(rd["name"]);
        }
        rd.Close();
     
    }
}



Unable to find sqlite3
Unable to find sqlite3
Unable to find sqlite3
DllNotFoundException: sqlite3
  at (wrapper managed-to-native) Mono.Data.Sqlite.UnsafeNativeMethods:sqlite3_open_v2 (byte[],intptr&,int,intptr)
  at Mono.Data.Sqlite.SQLite3.Open (System.String strFilename, SQLiteOpenFlagsEnum flags, Int32 maxPoolSize, Boolean usePool) [0x00000] in <filename unknown>:0
  at Mono.Data.Sqlite.SqliteConnection.Open () [0x00000] in <filename unknown>:0
  at (wrapper remoting-invoke-with-check) Mono.Data.Sqlite.SqliteConnection:Open ()
  at TestGUI.OnGUI () [0x00000] in <filename unknown>:0

(Filename:  Line: -1)

http://forum.unity3d.com/threads/114660-Unity-3D-Android-SQLite-Examples

libsqlite3.so 를 Assets/Plugins/Android



유료
Siaqodb
SQLiteKit











댓글

이 블로그의 인기 게시물

'xxx.exe' 프로그램을 시작할 수 없습니다. 지정된 파일을 찾을 수 없습니다.

goorm IDE에서 node.js 프로젝트로 Hello World Simple Server 만들어 띄워보기

애드센스 수익을 웨스턴 유니온으로 수표대신 현금으로 지급 받아보자.