ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christina Xu <chris...@yahoo.com>
Subject Re: Dynamically passing username/password while create JDBC connection in buildDaoManager
Date Mon, 24 Jul 2006 15:49:06 GMT
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 <lmeadors@apache.org> wrote:

> Are there placeholders for the user/password in the
> dao.xml?
> 
> Larry
> 
> 
> On 7/24/06, Christina Xu <christxu@yahoo.com> 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 

Mime
View raw message