Hello,

in my current project I have to change the database at runtime. Does anybody do 
this before? I found some information on spring and ibatis, but in my case I 
have a simple java application. 

I tried it with changing a properties file and creating a new SqlMapClient, but 
he always uses the old database.

heres my code:

        String propfile = "com/mydom/ibatis.properties";
        Properties props = Resources.getResourceAsProperties(propfile);

        String sqlmap = "./src/com/mydom/SqlMapConfig.xml";
        Reader reader = new FileReader(sqlmap);
        SqlMapClient sqlMap = SqlMapClientBuilder.buildSqlMapClient(reader, 
props);

        //doing some inserts, etc.

        props.setProperty("url", "jdbc:mysql://localhost:3306/otherdatabase");
        sqlMap = SqlMapClientBuilder.buildSqlMapClient(reader, props);

        //doing some inserts, etc

Any ideas?

greetz
wolle
-- 
GMX startet ShortView.de. Hier findest Du Leute mit Deinen Interessen!
Jetzt dabei sein: http://www.shortview.de/[EMAIL PROTECTED]

Reply via email to