Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 5 Next »

In XNAT 1.7, we are trying to make it easier for administrators to configure XNAT via the UI rather than having to modify properties files. However, there are some cases in which configuration must be done via properties file. In order to even access the database in which we store the properties for an XNAT instance, the XNAT instance needs to know how to access that database. These database access settings are stored in the xnat-conf.properties file. If there are other properties that you need (or want) to have set before you start configuring XNAT through the UI, these can also be set in properties files.

Setting properties in xnat-conf.properties

In your xnat webapp directory, there should be a file located at WEB-INF/conf/xnat-conf.properties. In the xnat source code, this file is located at src/main/webapp/WEB-INF/conf/xnat-conf.properties. This file should look something like this (with some comments at the top):

datasource.driver=org.postgresql.Driver
datasource.url=jdbc:postgresql://localhost/xnat
datasource.username=xnat
datasource.password=xnat

hibernate.dialect=org.hibernate.dialect.PostgreSQL9Dialect
hibernate.hbm2ddl.auto=update
hibernate.show_sql=false
hibernate.cache.use_second_level_cache=true
hibernate.cache.use_query_cache=true

The datasource properties here should be set to whatever you set them to when installing XNAT. If you used the dafults suggested in the installation instructions, you should not need to modify these. If you used a different database name than XNAT, you should change the datasource.url line like so:

datasource.url=jdbc:postgresql://localhost/YOUR_DATABASE_NAME

You should also change the username and password lines to match the database username and password you used when setting up XNAT. If you set these properties to the values used when creating your empty database, XNAT should correctly populate the database with all the tables you will need when you start Tomcat.

You should not need to modify any of the hibernate properties, but can if you wish. the dialect should be left set to org.hibernate.dialect.PostgreSQL9Dialect because XNAT queries are written for PostgreSQL version 9. You will probably want to leave the hibernate.hbm2ddl.auto property set to update so that the your schemas will update so that your database stays in sync with any code changes. This is especially important when upgrading from an earlier version of XNAT so that the database tables will match what XNAT expects (e.g. adding a column that is new in 1.7), while preserving your existing data. You can also change hibernate.show_sql to true if you want all SQL statements to be logged to the console. 

Setting Other Properties Files

The datasource properties here s

Deploy XNAT with your custom configuration

...

  • No labels