package uk.co.intec.utils; import lotus.domino.*; import com.ibm.commons.util.StringUtil; import com.ibm.xsp.application.ApplicationEx; import com.ibm.xsp.extlib.util.ExtLibUtil; public class AppUtils { private static String dataDbPath; private static String getXspProperty(String propertyName, String defaultValue) { String retVal = ApplicationEx.getInstance().getApplicationProperty(propertyName, getIniVar(propertyName, defaultValue)); return retVal; } private static String getIniVar(String propertyName, String defaultValue) { try { String newVal = ExtLibUtil.getCurrentSession().getEnvironmentString(propertyName, true); if (StringUtil.isNotEmpty(newVal)) { return newVal; } else { return defaultValue; } } catch (NotesException e) { return defaultValue; } } public static String getDataDbPath() { if (StringUtils.isEmpty(dataDbPath)) { setDataDbPath(); } return dataDbPath; } public static void setDataDbPath() { try { // Compute as required String dataDbPathTmp = getIniVar("dataDbPath", ExtLibUtil.getCurrentDatabase().getFilePath()); dataDbPath = dataDbPathTmp; } catch (Throwable t) { // handle exception } } public static Database getDataDb() { Database retVal_ = null; try { Session currSess = ExtLibUtil.getCurrentSession(); retVal_ = currSess.getDatabase(currSess.getServerName(), getDataDbPath()); } catch (Throwable t) { // handle exception } return retVal_; } } In datasources: <xp:this.databaseName><![CDATA[${javascript:importPackage(uk.co.intec.utils); AppUtils.getDataDbPath();}]]></xp:this.databaseName> In Java code: Database myDb = AppUtils.getDataDb();