LS 7.1
Really having trouble connecting the dots here. I need to connect to a different database depending on the runtime I am running in. Apparently, this is being done via the
etc/conf/livesite_customer/database.properties file for the LSRTPREVIEW connection. It looks like:
# flag to enable database functionality in LiveSite.
# if false, all database functionality will be disabled.
db.enabled=true
# test query used by the connection pool to ensure connection is open and working.
# Oracle: select 1 from dual
# SQLServer: select 1
# DB2: SELECT 1 FROM SYSIBM.SYSDUMMY1
db.testQuery=select 1 from dual
# the names, comma-delimited of the vendor-specific JDBC libraries ( JAR or ZIP file(s) )
# e.g. jdbcLibraries=sqljdbc.jar or jdbcLibraries=ojdbc14.jar,nls_charset12.zip
jdbcLibraries=ojdbc14.jar
...
# the production database schema connection info
production.driverClassName=oracle.jdbc.driver.OracleDriver
production.url=jdbc
racle:thin:@andy.sw.org:1521:TWEB
production.username=LSRTPREVIEW
...
Over in the
etc/conf/livesite/resources/production-resource-config.xml the following bean is defined:
[HTML]
class="org.apache.commons.dbcp.BasicDataSource"
destroy-method="close">
[/HTML]
So, can I create properties in the database.properties file on each server and reference them the same way?
To database.properties I would add something like:
web.username=PWEB
web.password=ENC(blahblablayblah)
Then in
/etc/conf/livesite_customer/resources/customer-resource-config.xml I would add:
[HTML]
parent="db.DefaultPoolFactory"
init-method="init">
[/HTML]
Then in my external I am hoping the following java code would get me the correct connection:
Connection conn = RequestUtils.getConnection("pweb");
How far off am I?