<?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[How To Hide A Source File(.db)]]></title><description><![CDATA[<p dir="auto">qt5.7 + sqlite3</p>
<p dir="auto">My programme need some data when it's running. That data is a lot ,and programme need read data frequently,So I write data to database(sqlite3),And then ,I put the file in sourcefile like this.</p>
<pre><code>/&lt;RCC&gt;
  &lt;qresource&gt;
     ..........
     &lt;file&gt;DataFile/SystemPix.db&lt;/file&gt;
     .........
  &lt;/qresource&gt;
&lt;/RCC&gt;
</code></pre>
<p dir="auto">And I connect sqlite3 in the progamme</p>
<pre><code>QSqlDatabase db = QSqlDatabase::addDatabase("QSQLITE");
db.setDatabase(":/DataFile/SystemPix.db");
if(!(db.open())
    qDebug()&lt;&lt;"Can't Connect Database.";
</code></pre>
<p dir="auto">As you see,progamme tell me "Can't Connect Database.".....<br />
Someone tell me do like this</p>
<pre><code>QFile fs(databaseFile);   //databaseFile is a path of file  like "/home/MyPro/RecordCard/Ds/pix.db"
if(!(fs.exist()))
    QFile::copy(":/DataFile/SystemPix.db",databaseFile);
QSqlDatabase db = QSqlDatabase::addDatabase("QSQLITE");
db.setDatabase(databaseFile);
//...
//..
</code></pre>
<p dir="auto">And then , I can connect the database,but this is a problem , user can look the data but I hope hide the data to user, even I delete the file when progamme is over , user also can look file(.db) when progamme is running.<br />
How could I hide the Data?If I don't copy file to some dir ,progamme can't connect the database(.db file),if I copy file to some dir,user can look at the data,do you have any good idea?</p>
<p dir="auto"><em>[Edit aha_1980: fixed title]</em></p>
]]></description><link>https://forum.qt.io/topic/90773/how-to-hide-a-source-file-db</link><generator>RSS for Node</generator><lastBuildDate>Thu, 02 Jul 2026 22:48:15 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/90773.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 16 May 2018 11:58:26 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to How To Hide A Source File(.db) on Wed, 16 May 2018 16:25:15 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/qazaq408">@<bdi>qazaq408</bdi></a> please keep in mind that when you use Qt resource system, the items you add to the RCC file will end up embedded into the executable of your application. The main use of this is to store small icons, translation files, etc.<br />
So, although nothing prevents you to embed your physical .db file into your app's executable, the SQLite driver is expecting a file in the filesystem that's your first  <em>"Can't Connect Database."</em> issue.<br />
See this <a href="http://www.qtcentre.org/archive/index.php/t-3174.html" target="_blank" rel="noopener noreferrer nofollow ugc">similar post</a> with a suggestion for changing the SQLite driver itself to access Qt's resource file system but even if you do that, I guess your DB will be read-only (if not, you'll be updating the executable file every time you write to the DB...)</p>
<blockquote>
<p dir="auto">How could I hide the Data?</p>
</blockquote>
<p dir="auto">Have you consider using SQLite encryption extension? spoiler alert: I've never used it myself.</p>
]]></description><link>https://forum.qt.io/post/458628</link><guid isPermaLink="true">https://forum.qt.io/post/458628</guid><dc:creator><![CDATA[Pablo J. Rogina]]></dc:creator><pubDate>Wed, 16 May 2018 16:25:15 GMT</pubDate></item><item><title><![CDATA[Reply to How To Hide A Source File(.db) on Wed, 16 May 2018 14:26:05 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/qazaq408">@<bdi>qazaq408</bdi></a><br />
Just how secure (against user looking at file) do you need/expect to be?  E.g. do you just want to prevent casual user from easily seeing the file, or do you want to hide it robustly from experienced user/hacker?</p>
<p dir="auto">Furthermore/alternatively, are you prepared to <em>pay</em> for software which will protect your data against inspection?  And/or are you using SQLite3?</p>
]]></description><link>https://forum.qt.io/post/458596</link><guid isPermaLink="true">https://forum.qt.io/post/458596</guid><dc:creator><![CDATA[JonB]]></dc:creator><pubDate>Wed, 16 May 2018 14:26:05 GMT</pubDate></item><item><title><![CDATA[Reply to How To Hide A Source File(.db) on Wed, 16 May 2018 12:11:44 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/qazaq408">@<bdi>qazaq408</bdi></a><br />
my guess is, that the sql driver needs write access to the DB file.<br />
Even if you don't plan to update/alter the data in the DB directly, the DB itself handles some stuff in the back and needs to keep it's state consistent and writes some stuff into the db file.</p>
]]></description><link>https://forum.qt.io/post/458571</link><guid isPermaLink="true">https://forum.qt.io/post/458571</guid><dc:creator><![CDATA[raven-worx]]></dc:creator><pubDate>Wed, 16 May 2018 12:11:44 GMT</pubDate></item></channel></rss>