Présentation du logiciel

Installation de Zotero

Accès direct à la base de donneés de Zotero

Documentation:

Liste à puceDirect Access to the Zotero SQLite Database

Zootero data directory and database restore

Zotero JavaScript API for local Zotero instance

CREATE VIEW v_zotero_items AS
SELECT
t1.itemID,
t2.typeName,
substr(t6.VALUE, instr(t6.VALUE, ' ') + 1) AS datation,
group_concat(t4.VALUE, ' # ') AS title
--	group_concat(t4.fieldName) as property,
--	group_concat(t5.value),
--	group_concat('itemData' || t5.valueID) AS id
FROM
items t1
JOIN itemTypes t2 ON	t2.itemTypeID = t1.itemTypeID
LEFT JOIN itemData t3 ON t3.itemID = t1.itemID AND t3.fieldID IN (110, 115,12)
LEFT JOIN itemDataValues t4 ON t4.valueID = t3.valueID
LEFT JOIN itemData t5 ON t5.itemID = t1.itemID AND t5.fieldID IN (14)
LEFT JOIN itemDataValues t6 ON t6.valueID = t5.valueID
WHERE t2.itemTypeID NOT IN (14, 1)
GROUP BY t1.itemID, t2.typeName;

Zotero database locked

Always make a copy of Zotero database first !

cp -pv zotero.sqlite zotero.sqlite2
rm -f zotero.sqlite
mv zotero.sqlite2 zotero.sqlite

Source: [[https://stackoverflow.com/questions/16419654/effectively-unlocking-an-sqlite-database|effectively unlocking an SQLite database]]
Repair database: [[https://www.zotero.org/utils/dbfix/|Zotero Database Repair Tool]]Your database has been rebuilt.
The new file is available here:
https://www.zotero.org/utils/dbfix/files/XG0S06XU/zotero.sqlite.zip (11605KB)
After downloading this file, unzip it, close Zotero, and place the extracted zotero.sqlite in your Zotero data directory, replacing the existing file. If there is a zotero.sqlite.is.corrupt file in the directory, delete it. (Be sure you've made a backup of the entire 'zotero' folder before performing these steps!)
When you're done, restart Zotero.
Please reference Upload ID 5c7841428fcf6 in any correspondence with the Zotero team regarding this repair.

Accès depuis une autre base de données SQLite

Apparemment marche seulement avec les clients à accès direct et non avec ceux qui utilisent le connecteur JDBC.

ATTACH '/Users/fberetta/Zotero/zotero.sqlite' AS zotero;
PRAGMA database_list;
SELECT * FROM zotero.v_zotero_items LIMIT 10;

Si la base de données de Zotero est inaccessible (message d'erreur: database is locked) il faut simplement copier la base de données, la coller dans un autre dossier, puis la recopier de nouveau et la recoller dans le dossier d'origine:

If you want to remove a "database is locked" error then follow these steps:
Copy your database file to some other location.
Replace the database with the copied database. This will dereference all processes which were accessing your database file. (Source: [[https://stackoverflow.com/questions/151026/how-do-i-unlock-a-sqlite-database/1027493#1027493|How do I unlock a SQLite database?]])

Ne surtout pas effacer le fichier zotero.sqlite-journal ! Et faire aussi des copies de sauvegarde férquentes et régulières de la base Zotero.

Mise à jour des données de la table zotero_data. Exécuter ce script SQL:

DELETE FROM zotero_data;
INSERT INTO zotero_data (itemId, typeName, datation, title)
SELECT itemID, typeName, datation, title FROM zotero.v_zotero_items;