jboss7 配jndi

来源:http://hi.baidu.com/mark_yz/item/5391200eaebc8b6ed45a1111

   a. 编辑tomcat下conf\context.xml,加入:

      <Resource name="jdbc/testjndi"

auth="Container"

type="javax.sql.DataSource"

driverClassName="com.mysql.jdbc.Driver"

url="jdbc:mysql://127.0.0.1:3306/testdb?useunicode=true&amp;characterEncoding=utf8"

username="root"

password="root"

maxActive="100"

maxIdle="30"

maxWait="10000" />

    b. 在工程的applicationContext.xml文件中加入 :

        <bean id="dataSource" class="org.springframework.jndi.JndiObjectFactoryBean">     

                   <property name="jndiName" value="java:comp/env/jdbc/testjndi"/>     

        </bean>

猜你喜欢

转载自ksgimi.iteye.com/blog/1705713