<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[What care i need to take when my 2 different thread access same database ?]]></title><description><![CDATA[<p dir="auto">i have one foreground  thread access on sqlite database  and background  thread access same database.  so in this type of situation what steps i need to take to avoid device getting slow, hang issue.</p>
]]></description><link>https://forum.qt.io/topic/132055/what-care-i-need-to-take-when-my-2-different-thread-access-same-database</link><generator>RSS for Node</generator><lastBuildDate>Fri, 06 Nov 2026 15:01:06 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/132055.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 17 Nov 2021 06:03:31 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to What care i need to take when my 2 different thread access same database ? on Wed, 17 Nov 2021 06:37:46 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/qt-embedded-developer">@<bdi>Qt-embedded-developer</bdi></a> said in <a href="/post/690401">What care i need to take when my 2 different thread access same database ?</a>:</p>
<blockquote>
<p dir="auto">Can you suggest efficient way for many queries</p>
</blockquote>
<p dir="auto">Simply open the connection once and use it for your queries. Close the connection when the app is closed.</p>
]]></description><link>https://forum.qt.io/post/690404</link><guid isPermaLink="true">https://forum.qt.io/post/690404</guid><dc:creator><![CDATA[jsulm]]></dc:creator><pubDate>Wed, 17 Nov 2021 06:37:46 GMT</pubDate></item><item><title><![CDATA[Reply to What care i need to take when my 2 different thread access same database ? on Fri, 19 Nov 2021 06:42:28 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/qt-embedded-developer">@<bdi>Qt-embedded-developer</bdi></a> said in <a href="/post/690788">What care i need to take when my 2 different thread access same database ?</a>:</p>
<blockquote>
<p dir="auto">but it make my ui stuck to wait for release mutex lock</p>
</blockquote>
<p dir="auto">Well, then analyse and fix your code - you have a dead-lock</p>
]]></description><link>https://forum.qt.io/post/690789</link><guid isPermaLink="true">https://forum.qt.io/post/690789</guid><dc:creator><![CDATA[jsulm]]></dc:creator><pubDate>Fri, 19 Nov 2021 06:42:28 GMT</pubDate></item><item><title><![CDATA[Reply to What care i need to take when my 2 different thread access same database ? on Fri, 19 Nov 2021 06:36:16 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/jsulm">@<bdi>jsulm</bdi></a> i have opened the database connection and not close it . but it make my ui stuck to wait for release mutex lock</p>
]]></description><link>https://forum.qt.io/post/690788</link><guid isPermaLink="true">https://forum.qt.io/post/690788</guid><dc:creator><![CDATA[Qt embedded developer]]></dc:creator><pubDate>Fri, 19 Nov 2021 06:36:16 GMT</pubDate></item><item><title><![CDATA[Reply to What care i need to take when my 2 different thread access same database ? on Wed, 17 Nov 2021 22:41:36 GMT]]></title><description><![CDATA[<p dir="auto"><a href="https://sqlite.org/threadsafe.html" target="_blank" rel="noopener noreferrer nofollow ugc">https://sqlite.org/threadsafe.html</a><br />
It sounds like sqlite is in mode 2.  So internally sqlite is using mutexes.</p>
]]></description><link>https://forum.qt.io/post/690574</link><guid isPermaLink="true">https://forum.qt.io/post/690574</guid><dc:creator><![CDATA[fcarney]]></dc:creator><pubDate>Wed, 17 Nov 2021 22:41:36 GMT</pubDate></item><item><title><![CDATA[Reply to What care i need to take when my 2 different thread access same database ? on Wed, 17 Nov 2021 06:46:13 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/qt-embedded-developer">@<bdi>Qt-embedded-developer</bdi></a> said in <a href="/post/690405">What care i need to take when my 2 different thread access same database ?</a>:</p>
<blockquote>
<p dir="auto">but this is the problem</p>
</blockquote>
<p dir="auto">No, it's not.<br />
I already wrote before: Create one connection in each thread.</p>
]]></description><link>https://forum.qt.io/post/690408</link><guid isPermaLink="true">https://forum.qt.io/post/690408</guid><dc:creator><![CDATA[jsulm]]></dc:creator><pubDate>Wed, 17 Nov 2021 06:46:13 GMT</pubDate></item><item><title><![CDATA[Reply to What care i need to take when my 2 different thread access same database ? on Wed, 17 Nov 2021 06:45:43 GMT]]></title><description><![CDATA[<p dir="auto">How to know which thread handler open the data base in foreground thread and background thread ?</p>
]]></description><link>https://forum.qt.io/post/690407</link><guid isPermaLink="true">https://forum.qt.io/post/690407</guid><dc:creator><![CDATA[Qt embedded developer]]></dc:creator><pubDate>Wed, 17 Nov 2021 06:45:43 GMT</pubDate></item><item><title><![CDATA[Reply to What care i need to take when my 2 different thread access same database ? on Wed, 17 Nov 2021 06:41:30 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/jsulm">@<bdi>jsulm</bdi></a> but this is the problem " no single database connection is used simultaneously in two or more threads" so i need to close the connection and open connection for  simultaneous access.</p>
<p dir="auto">So what is other efficient solution to tackle this issue ?</p>
]]></description><link>https://forum.qt.io/post/690405</link><guid isPermaLink="true">https://forum.qt.io/post/690405</guid><dc:creator><![CDATA[Qt embedded developer]]></dc:creator><pubDate>Wed, 17 Nov 2021 06:41:30 GMT</pubDate></item><item><title><![CDATA[Reply to What care i need to take when my 2 different thread access same database ? on Wed, 17 Nov 2021 06:37:46 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/qt-embedded-developer">@<bdi>Qt-embedded-developer</bdi></a> said in <a href="/post/690401">What care i need to take when my 2 different thread access same database ?</a>:</p>
<blockquote>
<p dir="auto">Can you suggest efficient way for many queries</p>
</blockquote>
<p dir="auto">Simply open the connection once and use it for your queries. Close the connection when the app is closed.</p>
]]></description><link>https://forum.qt.io/post/690404</link><guid isPermaLink="true">https://forum.qt.io/post/690404</guid><dc:creator><![CDATA[jsulm]]></dc:creator><pubDate>Wed, 17 Nov 2021 06:37:46 GMT</pubDate></item><item><title><![CDATA[Reply to What care i need to take when my 2 different thread access same database ? on Wed, 17 Nov 2021 06:36:27 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/jsulm">@<bdi>jsulm</bdi></a> Can you suggest efficient way for many queries. i have to improve this inefficient design to make it efficient. So Please suggest me how to do it ?</p>
]]></description><link>https://forum.qt.io/post/690401</link><guid isPermaLink="true">https://forum.qt.io/post/690401</guid><dc:creator><![CDATA[Qt embedded developer]]></dc:creator><pubDate>Wed, 17 Nov 2021 06:36:27 GMT</pubDate></item><item><title><![CDATA[Reply to What care i need to take when my 2 different thread access same database ? on Wed, 17 Nov 2021 06:26:06 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/qt-embedded-developer">@<bdi>Qt-embedded-developer</bdi></a> said in <a href="/post/690397">What care i need to take when my 2 different thread access same database ?</a>:</p>
<blockquote>
<p dir="auto">i am opening database and closing database when i want to execute sqlite query</p>
</blockquote>
<p dir="auto">Quite inefficient if you execute many queries</p>
]]></description><link>https://forum.qt.io/post/690399</link><guid isPermaLink="true">https://forum.qt.io/post/690399</guid><dc:creator><![CDATA[jsulm]]></dc:creator><pubDate>Wed, 17 Nov 2021 06:26:06 GMT</pubDate></item><item><title><![CDATA[Reply to What care i need to take when my 2 different thread access same database ? on Wed, 17 Nov 2021 06:25:32 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/qt-embedded-developer">@<bdi>Qt-embedded-developer</bdi></a> said in <a href="/post/690390">What care i need to take when my 2 different thread access same database ?</a>:</p>
<blockquote>
<p dir="auto">then How to make it simultaneously access</p>
</blockquote>
<p dir="auto">Create one connection in each thread...</p>
]]></description><link>https://forum.qt.io/post/690398</link><guid isPermaLink="true">https://forum.qt.io/post/690398</guid><dc:creator><![CDATA[jsulm]]></dc:creator><pubDate>Wed, 17 Nov 2021 06:25:32 GMT</pubDate></item><item><title><![CDATA[Reply to What care i need to take when my 2 different thread access same database ? on Wed, 17 Nov 2021 06:25:13 GMT]]></title><description><![CDATA[<p dir="auto">@J-Hilk i am opening database and closing database when i want to execute sqlite query</p>
]]></description><link>https://forum.qt.io/post/690397</link><guid isPermaLink="true">https://forum.qt.io/post/690397</guid><dc:creator><![CDATA[Qt embedded developer]]></dc:creator><pubDate>Wed, 17 Nov 2021 06:25:13 GMT</pubDate></item><item><title><![CDATA[Reply to What care i need to take when my 2 different thread access same database ? on Wed, 17 Nov 2021 06:14:12 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/qt-embedded-developer">@<bdi>Qt-embedded-developer</bdi></a><br />
I want an elaboration on how you made your database connections so far</p>
]]></description><link>https://forum.qt.io/post/690392</link><guid isPermaLink="true">https://forum.qt.io/post/690392</guid><dc:creator><![CDATA[J.Hilk]]></dc:creator><pubDate>Wed, 17 Nov 2021 06:14:12 GMT</pubDate></item><item><title><![CDATA[Reply to What care i need to take when my 2 different thread access same database ? on Wed, 17 Nov 2021 06:14:59 GMT]]></title><description><![CDATA[<p dir="auto">@J-Hilk said in <a href="/post/690389">What care i need to take when my 2 different thread access same database ?</a>:</p>
<blockquote>
<p dir="auto">SQLite can be safely used by multiple threads provided that no single database connection is used simultaneously in two or more threads.</p>
</blockquote>
<p dir="auto">I want elaboration of this statement</p>
<p dir="auto">" <strong>SQLite can be safely used by multiple threads provided that <em>no single database connection is used simultaneously in two or more threads.</em></strong>"</p>
<p dir="auto">If meaning of this statement is " i can not use same database connection in multiple thread"  then How to make it simultaneously access ?</p>
]]></description><link>https://forum.qt.io/post/690390</link><guid isPermaLink="true">https://forum.qt.io/post/690390</guid><dc:creator><![CDATA[Qt embedded developer]]></dc:creator><pubDate>Wed, 17 Nov 2021 06:14:59 GMT</pubDate></item><item><title><![CDATA[Reply to What care i need to take when my 2 different thread access same database ? on Wed, 17 Nov 2021 06:06:05 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/qt-embedded-developer">@<bdi>Qt-embedded-developer</bdi></a><br />
from <a href="http://sqlite.org" target="_blank" rel="noopener noreferrer nofollow ugc">sqlite.org</a></p>
<blockquote>
<p dir="auto">Multi-thread. In this mode, SQLite can be safely used by multiple threads provided that no single database connection is used simultaneously in two or more threads.</p>
</blockquote>
]]></description><link>https://forum.qt.io/post/690389</link><guid isPermaLink="true">https://forum.qt.io/post/690389</guid><dc:creator><![CDATA[J.Hilk]]></dc:creator><pubDate>Wed, 17 Nov 2021 06:06:05 GMT</pubDate></item></channel></rss>