properties file's path for MyBatis

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

properties file's path for MyBatis

陈抒
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hello,I want to change the database connection parameters after
deploying my Java application(jar file).

The props.properties file is under /home folder.I didn't try it,is it
possible?



<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE configuration PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-config.dtd">
<configuration>
       
        <properties resource="/home/props.properties"></properties>

        <environments default="development">
                <environment id="development">
                        <transactionManager type="JDBC" />
                        <dataSource type="POOLED">
                                <property name="driver" value="${jdbc.driverClassName}" />
                                <property name="url" value="${jdbc.url}" />
                                <property name="username" value="${jdbc.username}" />
                                <property name="password" value="${jdbc.password}" />
                        </dataSource>
                </environment>
        </environments>
        <mappers>
                <mapper resource="cn/ibatis/UserMapper.xml" />
        </mappers>
</configuration>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQEcBAEBAgAGBQJNtYyJAAoJEMJ+jXPzhUGSkIgH/3Otm3tnTXKeKYeN67FRjqbY
seNMEDqBro4+oJTD4CHJ96b71dGYluXHWAVQyH3pxy06KsPHcDQM/R6KmkUMLAtx
e7E9lNYGsOMVDEj3IngfH4xFz1LiSpySTPorF3bQjP16HIh0M7ESA+7zn9HQplLJ
NqkbmNcj7BuMnuv4IPDqCPnT18jSoD9vGiT2R8msJbmW2Z+TLCfkZm32saEJVXnf
ZOhqCDsJhJwwFaAbDzWCW983pLbFvQPmSuw0duG0zzN3vfoe3ljJF8p4AsUI1NPw
vz7WxIWOHtZuPnf18lUOnLcnVwX+FYY3ZC6zq3QX9kWIpVWsYIIviyZQ4md74a8=
=HN1V
-----END PGP SIGNATURE-----
Reply | Threaded
Open this post in threaded view
|

Re: properties file's path for MyBatis

Clinton Begin
Administrator
You can do it, but not with the resource attribute.  

Use the url attribute with a file:// url.  
       <properties url="file:///home/props.properties"/>
Clinton
<!ELEMENT properties (property*)>

<!ATTLIST properties
resource CDATA #IMPLIED
url CDATA #IMPLIED
>


2011/4/25 chenshu <[hidden email]>
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hello,I want to change the database connection parameters after
deploying my Java application(jar file).

The props.properties file is under /home folder.I didn't try it,is it
possible?



<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE configuration PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-config.dtd">
<configuration>

       <properties resource="/home/props.properties"></properties>

       <environments default="development">
               <environment id="development">
                       <transactionManager type="JDBC" />
                       <dataSource type="POOLED">
                               <property name="driver" value="${jdbc.driverClassName}" />
                               <property name="url" value="${jdbc.url}" />
                               <property name="username" value="${jdbc.username}" />
                               <property name="password" value="${jdbc.password}" />
                       </dataSource>
               </environment>
       </environments>
       <mappers>
               <mapper resource="cn/ibatis/UserMapper.xml" />
       </mappers>
</configuration>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQEcBAEBAgAGBQJNtYyJAAoJEMJ+jXPzhUGSkIgH/3Otm3tnTXKeKYeN67FRjqbY
seNMEDqBro4+oJTD4CHJ96b71dGYluXHWAVQyH3pxy06KsPHcDQM/R6KmkUMLAtx
e7E9lNYGsOMVDEj3IngfH4xFz1LiSpySTPorF3bQjP16HIh0M7ESA+7zn9HQplLJ
NqkbmNcj7BuMnuv4IPDqCPnT18jSoD9vGiT2R8msJbmW2Z+TLCfkZm32saEJVXnf
ZOhqCDsJhJwwFaAbDzWCW983pLbFvQPmSuw0duG0zzN3vfoe3ljJF8p4AsUI1NPw
vz7WxIWOHtZuPnf18lUOnLcnVwX+FYY3ZC6zq3QX9kWIpVWsYIIviyZQ4md74a8=
=HN1V
-----END PGP SIGNATURE-----