meta données pour cette page
  •  

Inspecter la base h2

les bases h2 sont interrogeable en SQL, avec un client java. l'accès n'est pas partagé et tant que geonetwork forntionne, il est impossible d'accéder à la base de données. la documentation du SQL compris est très bien faite1).

Ci dessous une copie de session montrant la base h2 /var/lib/tomcat8/geonetwork.h2.db.

  • :!: Le nom d'utilisateur par défaut est admin et le mot de passe par défaut est gnos.
  • :!: En cas d'erreur de frappe dans le nom de la base de données, une base toute neuve sera crée, sans avertissement. Ça peut surprendre.
root@deb8:~# systemctl stop tomcat8.service 
root@deb8:~# gnwdir=/var/lib/tomcat8/webapps/geonetwork
root@deb8:~# java -cp $gnwdir/WEB-INF/lib/h2-*jar org.h2.tools.Shell

Welcome to H2 Shell 1.3.174 (2013-10-19)
Exit with Ctrl+C
[Enter]   jdbc:h2:~/test
URL       jdbc:h2:/var/lib/tomcat8/geonetwork
[Enter]   org.h2.Driver
Driver    
[Enter]   sa
User      admin
[Enter]   Hide
Password  gnos
Connected
Commands are case insensitive; SQL statements end with ';'
help or ?      Display this help
list           Toggle result list / stack trace mode
maxwidth       Set maximum column width (default is 100)
autocommit     Enable or disable autocommit
history        Show the last 20 statements
quit or exit   Close the connection and exit

sql> show tables;
TABLE_NAME                 | TABLE_SCHEMA
ADDRESS                    | PUBLIC
CATEGORIES                 | PUBLIC
CATEGORIESDES              | PUBLIC
CSWSERVERCAPABILITIESINFO  | PUBLIC
CUSTOMELEMENTSET           | PUBLIC
EMAIL                      | PUBLIC
FILES                      | PUBLIC
GROUPS                     | PUBLIC
GROUPSDES                  | PUBLIC
GROUP_CATEGORY             | PUBLIC
HARVESTERDATA              | PUBLIC
HARVESTERSETTINGS          | PUBLIC
HARVESTHISTORY             | PUBLIC
INSPIREATOMFEED            | PUBLIC
INSPIREATOMFEED_ENTRYLIST  | PUBLIC
ISOLANGUAGES               | PUBLIC
ISOLANGUAGESDES            | PUBLIC
LANGUAGES                  | PUBLIC
MAPSERVERS                 | PUBLIC
METADATA                   | PUBLIC
METADATACATEG              | PUBLIC
METADATAFILEDOWNLOADS      | PUBLIC
METADATAFILEUPLOADS        | PUBLIC
METADATAIDENTIFIERTEMPLATE | PUBLIC
METADATANOTIFICATIONS      | PUBLIC
METADATANOTIFIERS          | PUBLIC
METADATARATING             | PUBLIC
METADATASTATUS             | PUBLIC
OPERATIONALLOWED           | PUBLIC
OPERATIONS                 | PUBLIC
OPERATIONSDES              | PUBLIC
PARAMS                     | PUBLIC
RELATIONS                  | PUBLIC
REQUESTS                   | PUBLIC
SCHEMATRON                 | PUBLIC
SCHEMATRONCRITERIA         | PUBLIC
SCHEMATRONCRITERIAGROUP    | PUBLIC
SCHEMATRONDES              | PUBLIC
SERVICEPARAMETERS          | PUBLIC
SERVICES                   | PUBLIC
SETTINGS                   | PUBLIC
SOURCES                    | PUBLIC
SOURCESDES                 | PUBLIC
STATUSVALUES               | PUBLIC
STATUSVALUESDES            | PUBLIC
THESAURUS                  | PUBLIC
USERADDRESS                | PUBLIC
USERGROUPS                 | PUBLIC
USERS                      | PUBLIC
VALIDATION                 | PUBLIC
(50 rows, 22 ms)
sql> select * from settings limit 10;
NAME                       | DATATYPE | INTERNAL | POSITION | VALUE
system/site/name           | 0        | n        | 110      | My GeoNetwork catalogue
system/site/organization   | 0        | n        | 130      | My organization
system/platform/version    | 0        | n        | 150      | 3.2.1
system/platform/subVersion | 0        | n        | 160      | 0
system/server/host         | 0        | n        | 210      | localhost
system/server/protocol     | 0        | n        | 220      | http
system/server/port         | 1        | n        | 230      | 8080
system/server/securePort   | 1        | y        | 240      | 8443
system/server/log          | 0        | y        | 250      | log4j.xml
system/intranet/network    | 0        | y        | 310      | 127.0.0.1
(10 rows, 7 ms)
sql> update settings set VALUE='Mon geo catalogue' where name = 'system/site/name';
(Update count: 1, 8 ms)
sql> select * from settings order by position limit 10;
NAME                       | DATATYPE | INTERNAL | POSITION | VALUE
system/site/name           | 0        | n        | 110      | Mon geo catalogue
system/site/siteId         | 0        | n        | 120      | 45c36a95-344d-43dd-b3bb-402df22a1ed0
system/site/organization   | 0        | n        | 130      | My organization
system/platform/version    | 0        | n        | 150      | 3.2.1
system/platform/subVersion | 0        | n        | 160      | 0
system/site/svnUuid        | 0        | y        | 170      | 1c667f43-321a-452c-bf92-70abe3accff2
system/server/host         | 0        | n        | 210      | localhost
system/server/protocol     | 0        | n        | 220      | http
system/server/port         | 1        | n        | 230      | 8080
system/server/securePort   | 1        | y        | 240      | 8443
(10 rows, 16 ms)
sql> exit
Connection closed
root@deb8:~# 
1)
Les diagrammes de la grammaire semblent fortement inspirés de ceux de SQLITE