I have added the line
- Code: Select all
DBVAL=mydb_dev
to catalina.properties.
Now I define a Realm in my webabb's context.xml:
- Code: Select all
<Realm className="org.apache.catalina.realm.JDBCRealm"
driverName="org.postgresql.Driver"
connectionURL="jdbc:postgresql://myserver:5432/${DBVAL}"
connectionName="xxx" connectionPassword="yyy"
userTable="users" userRoleTable="roles"
userNameCol="name" userCredCol="pw" roleNameCol="role"
digest="MD5" />
However, in the logfiles I can find:
org.postgresql.util.PSQLException: FATAL: database "${DBVAL}" does not exist
It seems, that the parameter value was not replaced.
What I would like to have is to define a Realm once in context.xml, that will be used both on a development and on a productive server. The servers define the actual name of the database (here "mydb_dev"), e.g. in catalina.properties.