Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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 /
avatar image
0
Question by bigoMay · May 11, 2016 at 03:21 PM · c#unity 5exceptionsqlite

Why does SQLite throw InvalidOperationException in Unity 5.3?

Hello,

I am having a little issue trying to use SQLite in Unity 5.3. I have been following the SQLite setup provided here (http://answers.unity3d.com/questions/743400/database-sqlite-setup-for-unity.html) and I have tried to open a sqlite database with the following code:

     void Start()
     {
             string conn = "URI=file:" + Application.dataPath 
                 + "/trajectoriesDB"; //Path to database.
     
             IDbConnection dbconn;
             dbconn = (IDbConnection) new SqliteConnection(conn);
             dbconn.Open();
             Debug.Log("Database open");
     
             dbconn.Close();
             dbconn = null;
     }

The problem is that, when the program reaches the line dbconn.Open();, Unity throws the following exception:

InvalidOperationException: Cannot set CommandText while a DataReader is active

I tested in a very simple scene where only this script is running, and I have also double checked that I have all the .dll I need in Assets/Plugins and the database file in Assets/.

I cannot find the root of this problem, since I do not have any DataReader in my code. Has anyone experienced the same problem before?

Thank you in advance!

Comment
Add comment · Show 1
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 FortisVenaliter · May 12, 2016 at 10:50 PM 0
Share

As far as I can tell, that doesn't appear to be an issue with Unity, but rather with your plugin... I would ask around on the forums for that plugin, and see if they can help. Since it's likely not a Unity-specific issue, you'll probably get better help there, since only a few Unity users will ever use SQLite with Unity.

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by Naphier · May 13, 2016 at 06:45 AM

We use SQLite for Unity. Initial setup was originally a bugger, but it works quite well. https://github.com/codecoding/SQLite4Unity3d

Comment
Add comment · Show 2 · Share
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 zhuk1011 · Mar 02, 2018 at 12:00 PM 0
Share

they have maximum useless unity examples for they projects and i dont saw api, how u read from existing db? where examples for command and reader? only 3388 lines class

avatar image Naphier zhuk1011 · Mar 02, 2018 at 07:54 PM 0
Share

SQLite4Unity3d/Example/Assets/Scripts/ Lots of basic examples. Queries can be done by linq or sql statements. Check out ExistingDBScript.cs

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

6 People are following this question.

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

Related Questions

Unity3d c# load or fill dataTable from sqLite local DataBase Error: sqlite3_column_Origin_name 0 Answers

Multiple Cars not working 1 Answer

Distribute terrain in zones 3 Answers

Unity3d c# load or fill dataTable from sqLite local DataBase Error: sqlite3_column_Origin_name 0 Answers

Unity3d c# load or fill dataTable from sqLite local DataBase Error: sqlite3_column_Origin_name 0 Answers


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