how read properties value from database.confid in generatoConfig my batis

116 Views Asked by At

Suppose to be in /resourses folder and there are two files (database.properties and generatorConfig.xml). My purpose is insert in database.properties the database properties:

jdbc.driverClassName="DRIVER"
jdbc.url="URL"
jdbc.username="****"
jdbc.password="****"

Now in my generatorConfig.xml I do:

    <generatorConfiguration>

         <properties resource="database.properties"></properties>
        <context id="context1">

            <jdbcConnection connectionURL="${jdbc.url}"
                driverClass="${jdbc.driverClassName}" password="${jdbc.password}"
                userId="${jdbc.user}" >

            </jdbcConnection>
....

But when I run the file I obtain this exception: java.lang.RuntimeException: Exception getting JDBC Driver It seems that It doesn't read the database.properties. Anyone can help me?

1

There are 1 best solutions below

0
On

This should work as long as /resources is on the classpath of the generator.