Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
13 Jun 22 - 14 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
This question was closed Jul 08, 2014 at 10:03 AM by tanoshimi for the following reason:

The question is answered, right answer was accepted

avatar image
91
Question by $$anonymous$$ · Jul 08, 2014 at 09:49 AM · databasesqlitestorage

Database (SQLite) Setup for Unity

  1. Create new folder under Assets Folder Rename it Plugins .

  2. Copy sqlite3.def and sqlite3.dll into Assets/Plugins in your unity project .You can download these files here http://www.sqlite.org/download.html for windows (Precompiled Binaries for Windows)

  3. Download SQLite Browser http://sourceforge.net/projects/sqlitebrowser/ or http://sqliteadmin.orbmu2k.de/ download SQLite Administrator tool

  4. Create Database in Assets folder in your unity project using SQLite Browser.

  5. Copy System.Data.dll and Mono.Data.Sqlite.dll from **C:\Program Files (x86)\Unity \Editor\Data\Mono\lib\mono\2.0* and paste them in your Assets/Plugins* folder in your unity project.

  6. Add these namespaces using Mono.Data.Sqlite; using System.Data; using System;

  7. string conn= "URI=file:" + Application.dataPath + "/PickAndPlaceDatabase.s3db";

Replace PickAndPlaceDatabase.s3db with your database name

void Start () {

     string conn = "URI=file:" + Application.dataPath + "/PickAndPlaceDatabase.s3db"; //Path to database.
     IDbConnection dbconn;
     dbconn = (IDbConnection) new SqliteConnection(conn);
     dbconn.Open(); //Open connection to the database.
     IDbCommand dbcmd = dbconn.CreateCommand();





     string sqlQuery = "SELECT value,name, randomSequence " + "FROM PlaceSequence";
     dbcmd.CommandText = sqlQuery;
     IDataReader reader = dbcmd.ExecuteReader();


     while (reader.Read())
     {
         int value = reader.GetInt32(0);
         string name = reader.GetString(1);
         int rand = reader.GetInt32(2);
        
         Debug.Log( "value= "+value+"  name ="+name+"  random ="+  rand);
     }

     reader.Close();
     reader = null;
     dbcmd.Dispose();
     dbcmd = null;
     dbconn.Close();
     dbconn = null;




 }



alt text

alt text

Further SQLite Help Visit : http://www.tutorialspoint.com/sqlite/

[1]: /storage/temp/28838-output.png

data.png (36.1 kB)
output.png (10.6 kB)
Comment
Add comment · Show 24
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image tarasfromlviv · Jul 08, 2014 at 09:57 AM 0
Share

Good stuff, but why making this a question?

avatar image $$anonymous$$ · Jul 08, 2014 at 10:03 AM 1
Share

I have posted this ,to help others. I was searching some help form different resource youtube,google to setup database and at end i write this article to help others.

avatar image tanoshimi · Jul 08, 2014 at 10:04 AM 0
Share

Ok, I'm going to close it as answered then, because otherwise it will keep on appearing as an active question :)

avatar image tanoshimi · Aug 24, 2016 at 06:50 AM 0
Share
@tanoshimi I am also following you as well. I follow the same steps as you mentioned above and it is working well for the editor and i think also working well for the window phone because you have added the precompiled libraries for the window phone. It is working for the editor but i want to use it for the android as well as for IOS. I have already wasted one day on it and i hope you will guide me in a proper way. Thanks !
avatar image · Aug 24, 2016 at 06:55 AM 0
Share
@tanoshimi Waiting for your reply. I had just created the account just to get the answer of it. I had used more than twenty queries in my application and it is not working in the android as well as IOS phone. I am really fed up of this.Help me otherwise my ten days work will be lost. Thanks !
avatar image vmachupalli · Jul 08, 2014 at 10:04 AM 0
Share

This looks more like a TIP/Tutorial.Why is this posted here? do you see an issue ?

avatar image tonyvicb · Jul 16, 2015 at 03:45 PM 2
Share

thanks .. another thing sir how can i work it on android??

avatar image tonyvicb · Aug 24, 2016 at 06:59 AM 1
Share

Did you find the answer of it ? I am also finding the solution how to work in android. If you have solved it then guide me.

Show more comments

0 Replies

  • Sort: 

Follow this Question

Answers Answers and Comments

26 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Alternative to storing data in DB's 2 Answers

Hiding the SQLite file 0 Answers

Sq lite Date base in unity 3d? 1 Answer

Implementing an offline Inventory that must sync with a server 0 Answers

How to connect my Application to SQLite Database? 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges