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>
<entry key="hibernate.default_schema" value="geonetwork"/>Also in the database properties set the database parameter to "database?currentSchema=geonetwork"