I need to recreate a SQLite database programmatically under iOS from a malformed database using this command. Which is original from: How to recover a corrupt SQLite3 database?
$ sqlite3 mydata.db ".dump" | sqlite3 new.db
or a equivalent command like this.
$ sqlite3 test.db '.dump' > dbbackup
Scenario: I need a function in my App which could detect the malformed Sqlite database and repair it self.
I used the sqlite3_backup- functions to recreate it, but the recreated database also malformed. But the database which was created with the help of the first command seems to be ok.
But the command is only for terminal and how can I trigger using iOS programmatically?
NB: Any other way to solve the problem also welcomed.
Related
trying to get Azerothcore running with Docker. I have the following error when trying to start up the service:
>> Applying update "2022_06_14_01.sql" '90B07D9'...
mysql: [Warning] Using a password on the command line interface can be insecure.
ERROR 1060 (42S21) at line 3: Duplicate column name 'artkit0'
Applying of file '/azerothcore/data/sql/updates/db_world/2022_06_14_01.sql' to database 'acore_world' failed! If you are a user, please pull the latest revision from the repository. Also make sure you have not
applied any of the databases with your sql client. You cannot use auto-update system and import sql files from AzerothCore repository with your sql client. If you are a developer, please fix your sql query.
Could not update the World database, see log for details.
Any help would be greatly appreciated. I'm a total noob to this!
I am receiving the same error. I have tried the various install types and made sure that things were cleaned up before trying again. I even went as far as to reformat and start from scratch. All yield the same as OP:
ERROR 1060 (42S21) at line 3: Duplicate column name 'artkit0'
I found a work around that worked for me. I dropped all the tables within acore_world and ran the server and let it repopulate it.
Update to the latest AzerothCore and try again
Background
I am trying to encrypt my sqlite database using sqlite3 and sqlcipher in an Electron application.
On the sqlite3 npm page here
It says to install the build like this,
yarn add sqlite3#4.0.8 --build-from-source --sqlite_libname=sqlcipher
--sqlite=brew --prefix --runtime=electron --target=4.0.0 --dist-url=https://atom.io/download/electron
I have installed sqlcipher with home brew.
brew install sqlcipher
Problem Example
I am trying to create an encrypted database like this in my Electron application,
const sqlite3 = require('sqlite3').verbose();
var db = new sqlite3.Database('./src/encryptedDB.sql');
db.serialize(function() {
db.run("PRAGMA KEY = 'secret'");
db.run("PRAGMA CIPHER = 'aes-256-cbc'");
db.run('CREATE TABLE IF NOT EXISTS clients (info TEXT)');
var stmt = db.prepare('INSERT INTO clients VALUES (?)');
for (var i = 0; i < 10; i++) {
stmt.run('wunO Background Client Number - ' + i);
}
stmt.finalize();
});
This is not creating an encrypted database. I can open the file and see data inside of it.
Question
I am trying to figure out if this is a simple problem with my syntax or if maybe when the electron builder runs it's magic in the background, it is rebuilding sqlite and removing the sqlcipher build.
How do I create an encrypted sqlite build that will work on MacOS and Windows.
I can open the file and see data inside of it.
Since it's not asking for any type of passwords, then there must be problem with database creation. In the readme of Electron-builder it states that
To ensure your native dependencies are always matched electron version, simply add script "postinstall": "electron-builder install-app-deps" to your package.json.
Place the following line in your package.json and repeat the installation process again, this resolved the problem for me.
"postinstall": "install-app-deps",
Also, I have created a small Vue + Electron + Vuetify + SQLite (with Seqlize & Sqlcipher) starter kit that has all the things you need already setup. The source code to generate encrypted database can be found in src/renderer/models.js give it a look.
https://github.com/rizalishan/vue-electron-starter
I'm trying to dump a database on Neo4j Desktop 3.5.0 with:
...\bin> neo4j-admin dump --database=graph.db --to=/backup/db1.dump
And getting
command failed: Active logical log detected, this might be a source of inconsistencies.
Please recover database before running the dump.
To perform recovery please start database and perform clean shutdown.
The documentation states that "neo4j-admin must be invoked as the neo4j user in order to ensure the appropriate file permissions.". Might that be the problem?
If so, how to "invoke as the neo4j user"?
found workaround.
shutdown database
open terminal
run bin/neo4j console
after startup, hit Ctrl+C to shutdown database
then, run neo4j-admin dump respectivery
confirmed on Neo4j Desktop 1.1.15
This may be a known issue in version 3.5.0.
I had the same problem on Neo4j 4.1, what worked for me was to simply:
Stop the database
Start the database
Stop it again
After which neo4j-admin dump worked.
Credit for the solution to #folterj's last answer on this thread.
For me I was using different neo4j versions for creating (4.4.0) and dumping (4.2.6) the database
Ok, so I have Postgres.app on my mac.
It's running locally insofar as I know. (the little elephant icon in top bar)
Created a very basic rails application, and it worked fine, ie, it showed up in browser.
Trying to connect it to Navicat Lite http://www.navicat.com/. It keeps coming up with this error: FATAL: role "postgres" does not exist.
Can't quite figure out how to solve this, so I happened to come across Induction http://inductionapp.com/ and tried to use it to connect to Postgres again, and this is the error it comes up with:
Connection Error
could not connect to server: Permission denied
Is the server running locally and accepting connections on Unix domain socket "/var/pgsql_socket/.s.PGSQL.5432"?
Not really sure how to solve this.
Have googled around on this, and some of the fixes seemed a little complicated, and right now, don't want to do fixes that I can't quite understand nor rollback.
Halp?
EDIT (including my bash info)
export PGHOST=localhost
PATH="/Applications/Postgres.app/Contents/MacOS/bin:$PATH"
export PATH=/usr/local/bin:$PATH
PATH=$PATH:$HOME/.rvm/bin # Add RVM to PATH for scripting
### Added by the Heroku Toolbelt
export PATH="/usr/local/heroku/bin:$PATH"
EDIT TWO
Ok, not sure how this happened of sorts.
Was randomly running Navicat again (sort of like a mouse in a running wheel?), and changed a few of the data entered on 'Connection Properties' page, ie, username and password - set it to what my laptop's info is.
It worked.
So, yay?
But then when I tried it with Induction, got the same error as listed in this post.
So, not sure what's going on, and why simply it works for Navicat and not Induction?
EDIT THREE
Hm ... ok, just tried Induction again, and actually typed localhost this time instead of leaving it to their default of 127.0.0.0 ... and it worked!
Hm, is this good news?
Also, the results of 'which psql' is this: /usr/bin/psql which doesn't seem right to me, given what I've put in my bash profile.
Um, not trying to prolong this post, nor add questions that could be saved for another post. I guess technically since I've got both Navicat and Induction working that this post is now invalid?
Should I make my question about psql path another post?
Please let me know.
Thank you.
Have removed results of echo $PATH.
Seems like your rails app is trying to connect to the standard postgres installation that is shipped with OSX vs. the postgresapp.
Have you followed these steps as part of the postgresapp setup (http://postgresapp.com/documentation)?
PostgreSQL ships with a constellation of useful binaries, like pg_dump or pg_restore, that you will likely want to use. Go ahead and add the /bin directory that ships with Postgres.app to your PATH (preferably in .profile, .bashrc, .zshrc, or the like to make sure this gets set for every Terminal session):
PATH="/Applications/Postgres.app/Contents/MacOS/bin:$PATH"
Once your path is correctly set up, you should be able to run psql without a host. (If not, check that the correct version is being loaded in the PATH by doing which psql)
Also, re-install your pg gem.
I tried creating sqlite3 database in my MAC OS X machine using the xxx.sql script file. But I am getting an error. The sql file is created on Windows system.
Command I used:
sqlite3 bizApp1.sqlite < DBCreationScript_8thNov2012_New.sql
Result:
Error: incomplete SQL: ??/
The error seems to be a syntax error.
If you're a beginner you can use an easy soft like SQLite Data Browser