ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christina Xu <chris...@yahoo.com>
Subject Dynamically passing username/password while create JDBC connection in buildDaoManager
Date Mon, 24 Jul 2006 13:42:10 GMT
Hello All, 

I have a requirement to Dynamic set username/password
when create JDBC connection. So what I have is :

   <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" />

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 =
daoManager =


When I run this, I got Error
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 

View raw message