Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 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 zhuchun · Dec 09, 2012 at 03:19 AM · databasesqlite

Do Sqlite have to close connection?

Hi

I'm developing a mobile game and using Sqlite(mono.data.sqlite) as native database. Is there any problem if I open database when game start and never close it?(Only this single thread game will visit the database) Such as timeout, memory leak or something else. Thank you!

Comment
Add comment
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

1 Reply

· Add your reply
  • Sort: 
avatar image
0
Best Answer

Answer by zhuchun · Aug 02, 2013 at 12:41 PM

ah... I almost forget this question. Answer is if you're using native database, with single connection, then you don't need to care about its cost. Open/close it as you wish :)

Comment
Add comment · Show 3 · 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 alonsoGarrote · Sep 15, 2013 at 12:26 PM 0
Share

Hi, what do you mean by "native database?, Im using a sqlite DB using $$anonymous$$ONO dlls. I also wanted to know if you must close an opened connection?,

avatar image zhuchun · Sep 16, 2013 at 07:11 AM 0
Share

@alonsoGarrote You may know SQLite only allow 1 user write to it in the same time, and in Unity, SQLite file will be lock if last write session still open, this lock will not be release until close your connection/editor/app.

So the reason why we close connection is to release that write lock, but not saving system cost.

In other words, either store your Sqlite helper as a static class(easier way, only one session, then you don't have to close it manually), or open/close it as you want(more flexible if you need to write DB between different sessions, such as apps).

avatar image alonsoGarrote · Sep 16, 2013 at 04:02 PM 0
Share

Thank you, ill take into account. By the way, can you give me a hand on this?: link text I Cant make this work yet..please, its for my college project.

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

10 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

Related Questions

why sqlite can't conneted after build in PC (.exe) 0 Answers

Deleting the main database at runtime. 0 Answers

how to access and modify my existing database made by DB browser for SQLite in unity after build 0 Answers

SQLite Query error 0 Answers

how to use database in unity for developing android games? 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