[ http://issues.apache.org/jira/browse/IBATIS-83?page=comments#action_61380 ] Saravanan Raju commented on IBATIS-83: --------------------------------------
If I understood your question correctly there is a way to assign values dynamically for the "keys" defined in sqlmapconfig xml file. This is what I did: sqlmapconfig xml file ------------------------------------------- <transactionManager type="JDBC"> <dataSource type="SIMPLE"> <property name="JDBC.Driver" value="oracle.jdbc.driver.OracleDriver"/> <property name="JDBC.ConnectionURL" value="jdbc:oracle:thin:@${host}:${port}:${instance}"/> <property name="JDBC.Username" value="${username}"/> <property name="JDBC.Password" value="${password}"/> </dataSource> </transactionManager> ------------------------------------------ My Singleton ------------------------------------------ Properties dbprop = new Properties(); dbprop.put("host", getProperty("host")); dbprop.put("port", getProperty("port")); dbprop.put("instance", getProperty("instance")); dbprop.put("username", getProperty("username")); dbprop.put("password", getProperty("password")); Reader reader = Resources.getResourceAsReader("ConfigFileName") daoManager = DaoManagerBuilder.buildDaoManager(reader, dbprop); //getProperty() impl knows to return the requested property values as you wish. ------------------------------------------- > Dynamically set data source and other properties in sqlmapconfig.xml > -------------------------------------------------------------------- > > Key: IBATIS-83 > URL: http://issues.apache.org/jira/browse/IBATIS-83 > Project: iBatis for Java > Type: New Feature > Components: SQL Maps > Reporter: Scott Z > Priority: Minor > > Right now, the only way you can include resource is to include a <property > resource=""/> element to include a file or url. The properties in that > resource might be used to define property values in the sqlMapConfig.xml, for > example, for the DataSource property. But sometimes we need to set this > values at runtime, i.e. we can't ask the user to put this in a predefined > property file. The values can be fetched at runtime and we need somehow feed > them to SqlMap when we parse the file and build our SqlMapClient instance. -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa - If you want more information on JIRA, or have a bug to report see: http://www.atlassian.com/software/jira