Database configuration via JNDI

The Enterprise edition of GeoNetwork requires JNDI to set up your database connections. JNDI is the optimal choice in production situations, because it doesn't require configuration script updates at (re)deployment. JNDI is set up at the container level.

3 examples for setting up JNDI in various containers with various databases. Pick the jndi configuration for the database you want to use. Rename the file to geonetwork.xml (or to appName.xml if you use another name). Put the file at the proper location (for tomcat: tomcat/conf/Catalina/localhost). And place the jar for the driver you want to use is in server/lib.

For Oracle 11 http://download.oracle.com/otn/utilities_drivers/jdbc/11204/ojdbc6.jar
For Postgres https://jdbc.postgresql.org/download.html 


jetty+H2
<Context>
<Environment name="gnDatabaseDialect" value="H2" type="java.lang.String" override="false"/>
<Resource name="jdbc/geonetwork" auth="Container"
type="javax.sql.DataSource" driverClassName="org.h2.Driver"
url="jdbc:h2:gn;LOCK_TIMEOUT=20000;DB_CLOSE_ON_EXIT=FALSE;MVCC=TRUE"
username="www-data" password="www-data" maxActive="20" maxIdle="10" defaultAutoCommit="false"
maxWait="-1"/>
</Context>
 

tomcat+postgres
<Context>
<Environment name="gnDatabaseDialect" value="POSTGRESQL" type="java.lang.String" override="false"/>
<Resource name="jdbc/geonetwork" auth="Container"
type="javax.sql.DataSource" driverClassName="org.postgresql.Driver"
url="jdbc:postgresql://localhost:5432/postgres"
username="postgres" password="postgres" maxActive="20" maxIdle="10" defaultAutoCommit="false"
maxWait="-1"/>
</Context>
 

tomcat+oracle

<Context>
<Environment name="gnDatabaseDialect" value="ORACLE" type="java.lang.String" override="false"/>
<Resource name="jdbc/geonetwork" auth="Container"
type="javax.sql.DataSource" driverClassName="oracle.jdbc.OracleDriver"
url="jdbc:oracle:thin:@//localhost:49161/xe"
username="system" password="oracle" maxActive="20" maxIdle="10" defaultAutoCommit="false"
maxWait="-1"/>
</Context>


By default GeoNetwork uses the "public" schema in a PostGres database. If you want to set a custom schema, there are 2 things to manage. in config-spring-geonetwork.xml you have to uncomment the line, and set its value to the desired schema-name:
<entry key="hibernate.default_schema" value="geonetwork"/>
Also in the database properties set the database parameter to "database?currentSchema=geonetwork"
 
 
  • 2 Utilisateurs l'ont trouvée utile
Cette réponse était-elle pertinente?

Articles connexes

Schema-plugins

Many schema-plugins are available to extend GeoNetwork to support various metadata schema's. A...

What is GeoNetwork?

GeoNetwork is a catalog application to register resources, with a focus on geospatial datasets...

Skins and personalisation

In GeoNetwork Enterprise a skin called 'minimal' is available to replace the default GeoNetwork...