How could I put username/password in dao.xml file? in dao.xml file I have:
<!DOCTYPE daoConfig PUBLIC "-//ibatis.apache.org//DTD DAO Configuration 2.0//EN" "http://ibatis.apache.org/dtd/dao-2.dtd"> <daoConfig> <context> <transactionManager type="SQLMAP"> <property name="SqlMapConfigResource" value="sql-map-config.xml"/> </transactionManager> <dao interface="com.abc.dao.ContentOrderDao" implementation="com.abc.dao.sqlmap.SqlMapDao"/> </context> </daoConfig> in sql-map-config.xml file I have: <sqlMapConfig> <properties resource="dataSource.properties" /> </sqlMapConfig> So When I put username/password to dataSource.properties file it works fine. BUT, but when I put EMPTY username/password (just for placehold) or fake username/password in dataSource.properties it brakes. driver=oracle.jdbc.driver.OracleDriver url=jdbc.oracle.thin:@hostname:1521:SID username= password= The way IBATIS behaive looks like to me it didn't take the properties passing to the DaoManagerBuilder.buildDaoManager(reader, properties). in java I have: Properties daoProp = new Properties(); daoProp.put("JDBC.username", username); daoProp.put("JDBC.password", password); Reader reader = Resources.getResourceAsReader(dbSource); daoManager = DaoManagerBuilder.buildDaoManager(reader, daoProp); Should IBatis get this JDBC.username and JDBC.password from daoProp instead of .xml or other property files. Thanks, Help is really needed . --- Larry Meadors <[EMAIL PROTECTED]> wrote: > Oh, OK - you need to add those to the dao.xml file, > too. > > Larry > > > On 7/24/06, Christina Xu <[EMAIL PROTECTED]> wrote: > > No. I don't have user/password defined in dao.xml. > Not > > in any .xml or property files. > > > > In dataSource.properties file, I only have > > > > driver=oracle.jdbc.driver.OracleDriver > > url=jdbc.oracle.thin:@hostname:1521:SID > > > > Any help is appreciated. Thanks. > > > > --- Larry Meadors <[EMAIL PROTECTED]> wrote: > > > > > Are there placeholders for the user/password in > the > > > dao.xml? > > > > > > Larry > > > > > > > > > On 7/24/06, Christina Xu <[EMAIL PROTECTED]> > wrote: > > > > Hello All, > > > > > > > > I have a requirement to Dynamic set > > > username/password > > > > when create JDBC connection. So what I have is > : > > > > > > > > <sqlmapConfig> > > > > <properties > resource="dataSourse.properties" /> > > > > <transactionManager type="JDBC" > > > > > <dataSource type="SIMPLE" > > > > > <property name="JDBC.Driver" > > > value="${driver}" > > > > /> > > > > <property name="JDBC.ConnectionURL" > > > > value="${url}" /> > > > > <property name="JDBC.DefaultAutoCommit" > > > > value="false" /> > > > > ... > > > > ... > > > > </dataSource> > > > > </transactionManager> > > > > ... > > > > ... > > > > </sqlMapConfig> > > > > > > > > In java, > > > > > > > > public void loadDaoManager(String username, > String > > > > password) { > > > > > > > > String dbSource="dao.xml" > > > > Properties daoProp = new Properties(); > > > > daoProp.put("JDBC.username", username); > > > > daoProp.put("JDBC.password", password); > > > > > > > > Reader reader = > > > > Resources.getResourceAsReader(dbSource); > > > > daoManager = > > > > > DaoManagerBuilder.buildDaoManager(reader.daoProp); > > > > ... > > > > ... > > > > > > > > } > > > > > > > > When I run this, I got Error > > > > > > > > "com.ibatis.common.exception.NestedRuntimeException: > > > > SimpleDataSource: Some properties were not > set." > > > > > > > > My question is is it possible to Dynamic give > > > > username/password in the properties instead > > > hardcode > > > > in .xml file? If yes, can someone give me > > > direction on > > > > how? Thanks a lot. > > > > > > > > > > > > > > > > > __________________________________________________ > > > > Do You Yahoo!? > > > > Tired of spam? Yahoo! Mail has the best spam > > > protection around > > > > http://mail.yahoo.com > > > > > > > > > > > > > __________________________________________________ > > Do You Yahoo!? > > Tired of spam? Yahoo! Mail has the best spam > protection around > > http://mail.yahoo.com > > > __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com
