Ok, I have added the line

DBVAL=mydb_dev

to catalina.properties.

Now I define a Realm in my webabb's context.xml:

<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.


Christopher Schultz-2 wrote:
> 
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> Laicreparc,
> 
> On 4/13/2011 11:38 AM, Laicreparc wrote:
>> How can the variable (i.e. here BPVAL be set)? E.g. in server.xml?
> 
> Did you read the post? It says how to set those values.
> 
>> Is <context-param> really in context.xml? Looks more like web.xml to
>> me.
> 
> I think it was just an example. Would you prefer <Resource
> param="${BPVAL}" />?
> 
> - -chris
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.10 (MingW32)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
> 
> iEYEARECAAYFAk2mCvYACgkQ9CaO5/Lv0PAM/ACdHAmti7Wf11o5AUqivmk3iZtw
> VpsAoLv7NToDVbVThrVCRgO1KTlX21nt
> =g1qE
> -----END PGP SIGNATURE-----
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
> 
> 
> 

-- 
View this message in context: 
http://old.nabble.com/%27Parametrizing%27-context.xml--tp26780552p31397140.html
Sent from the Tomcat - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to