I have a sqlite command line and works fine, but when it comes to the gui, there's the problem. I installed both Database Master and Expert Professional. When I create a random database and import a ready-made .sql script, I get a "syntax" error. Eventhough .read works and the database is executed in command line.
Error Expert Professional (similar to Database Manager): Data transfer error: near ".": syntax error
Any pointers?
Thanks
Found the solution. I had to delete some commands that don't work in gui but work in command-line.
Related
I'm using MariaDB version 10.5.9.0, the application I'm writing is using MSVC 2015 with Qt 5.9.2
Today I am seeing an error from the database when I try to execute one of my stored procedures, the procedure hasn't changed and has been working without any issues for quite a while.
The error displayed is:
Commands out of sync; you can't run this command now QMYSQL: Unable to execute query
Yet, despite this error the stored procedure works and the data is added to the database.
I've tried selecting everything in the database using HeidiSQL then using the Tools > Maintenance, Check then Analyse, the Repair and finally Optimize
Still the same issue.
Resolved, the issue was calling QSqlQuery and then another subquery using QSqlQuery again without calling clear on the first query.
I have a huge problem... I am developing desktop app with SQLite but during copy/paste process I lost a power and process was terminated so base was lost. However, I found a way to recover it but base is encrypted. When I try to open connection using conn.Open(); I get this error. If I try to open it with DB Browser for SQLite it asks me a SQLCipher encryption password so it seams to me that data is lost..
Is there any default password ?
Why did this happen and how to prevent it from happening again ?
What can I do ?
Thanks in advance.
Also check that SQLite version you're "connecting" with aligns with the DB file version.
For example, here's a DB file written by SQLite version 3+:
$ file foobar.db
foobar.db: SQLite 3.x database, last written using SQLite version 3027002
And here I also have 2 versions of sqlite:
$ sqlite -version
2.8.17
$ sqlite3 -version
3.27.2 2019-02-25 16:06:06 bd49a8271d650fa89e446b42e513b595a717b9212c91dd384aab871fc1d0alt1
Obviously in hindsight, opening foobar.db with sqlite version 2 will fail, yielding the same error message:
$ sqlite foobar.db
Unable to open database "foobar.db": file is encrypted or is not a database
But all is good with the correct version:
$ sqlite3 foobar.db
SQLite version 3.27.2 2019-02-25 16:06:06
Enter ".help" for usage hints.
sqlite>
sqlite> .databases
main: /tmp/foobar.db
sqlite>
The error message is a catch-all, simply meaning that the file format was not recognized.
Ok, finally found a solution that works so posting the answer if anybody will have same trouble as I did..
First of all, use good recover software. For repairing the database I found 3 solutions that work without backup :
Open corrupted database using DB Browser an Export Database to SQL. Name it however you want. Then, create new database and import database from SQL.
There is software that repairs corrupted databases. Download one and use it to repair the database.
Download "sqlite3" from sqlite.org and in command line navigate to folder where "sqlite3" is unzipped. Then try to dump the entire database with .dump, and use those commands to create a new database:
sqlite3 corrupt_table_name.sqlite ".dump" | sqlite3 new.sqlite
I had the same error when I was trying to access a db dump in another system compared to compared to where it was obtained. When I tried to open on a dev machine, it threw the reported error in this thread:
$ sqlite3 db_dump.sqlite .tables
Error: file is encrypted or is not a database
This turned out to be due to the differences in the sqlite version between those systems. This dev system version was 3.6.20.
The version on the production system was 3.8.9. Once I had the sqlite3 upgraded to same version, I was able to access all its data. I am just showing below the tables are displayed as expected:
# sqlite3 -version
3.8.9
# sqlite3 db_dump.sqlite .tables
capture diskio transport
consumer filters processes
This error is rather misleading to begin with, though.
If you've interacted with the database at some point while specifying journal_mode = WAL, and then later try to use the database from a client that does not support WAL (< v3.7.0), this error can also come up.
As noted in the SQLite documentation under Backwards Compatibility, to resolve that without having to recreate the database, explicitly set the journal mode to DELETE:
PRAGMA journal_mode=DELETE;
Your database did not become encrypted (this is only one of the two options in the error message).
Your data recovery tool did not recover the correct data; what you have in the file is something else.
You have to restore the database file from the backup.
The issue is with sqlcipher version upgrade in my case, Whenever I update my pod it automatically upgrade the sqlcipher and the error occurred.
For a quick fix just manually add the SDK instead of Pod install. And for a proper solution use this link GitHub Solution
I am trying to use sqlite3 in a Native Client application. There is a port available in the Chromium project, but I was unable to make it run properly.
My problem is that, for some reason, the application is unable to open a DB since a call like sqlite3_open("/filename.db", &db); fails with an I/O error.
I mounted / to a html5fs file system.
Has anybody managed to use SQLite with Native Client?
If so, I would really like to see a simple code that does something like opening a DB, CREATE a table, INSERT something and do a SELECT.
Struggled for almost a day, I found a workaround to skip the disk I/O error with specifying a VFS parameter.
sqlite3_open_v2(filename, &db, SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE | SQLITE_OPEN_NOMUTEX, "unix-none");
For more information about VFS, please see http://www.sqlite.org/vfs.html
My testing environment is on a chrome extension.
I've just started using SQLite, following the tutorials here and I'm using this on windows. I've got sqlite3.exe extracted to a folder on my desktop, and am running the following line in a command prompt to test it:
sqlite3 test.db
which the official documentation claims should create a file called test.db to work with. However, it doesn't appear to be doing anything, no files are created and it gives no errors or success messages, just another sqlite> prompt. Am I missing something to get this working on windows 7? Thanks.
If the database file does not exist, SQLite starts with an empty database.
The file itself will not be created until you actually write to the database.
Try creating something:
CREATE TABLE Test(some stuff);
Very basic question, having a hard time finding an explanation online.
I have a file code.sql that can be run on two different databases, a.db3 and b.db3. I used sqlite a.db3 to open the database in sqlite3. How do I run code.sql on it?
Use the .read code.sql command, or call sqlite3 with the file as input: sqlite3 a.db3 < code.sql.
I am guessing that you are trying to use the sqlite3 command line tool that you can dowload from the sqlite.org website.
I recomend that you use, instead, sqlitestudio http://sqlitestudio.one.pl
This has a feature to execute SQL from a file on a database:
Use DB Browser for SQLite is a high quality, visual, open source tool to create, design, and edit database files compatible with SQLite.
You can download the DB Browser at SQLite https://sqlitebrowser.org/