Hi All, I saw many people got confused of configuring DataSource JNDI on JBoss, I saw two major example, but for me only one works.
I use Spring 2.5.6, Jboss 4.2.2GA, Sun JDK 1.5 Example 1:(works) mysql-ds.xml <?xml version="1.0"?> | <datasources> | <local-tx-datasource> | <jndi-name>jdbc/esoafds</jndi-name> | <connection-url>jdbc:mysql://192.168.1.2:3306/jbranch?useUnicode=true&characterEncoding=UTF8&autoReconnect=true</connection-url> | <driver-class>com.mysql.jdbc.Driver</driver-class> | <user-name>root</user-name> | <password></password> | <min-pool-size>3</min-pool-size> | <max-pool-size>100</max-pool-size> | <use-java-context>false</use-java-context> | <metadata> | <type-mapping>mySQL</type-mapping> | </metadata> | </local-tx-datasource> | </datasources> Spring applicationContext.xml <jee:jndi-lookup id="dataSource" jndi-name="jdbc/esoafds" resource-ref="false" /> Above example, could someone advises me why I have to add <use-java-context>false</use-java-context> to make this config works? Example 2:(It should work, but NOT) mysql-ds.xml <?xml version="1.0"?> | <datasources> | <local-tx-datasource> | <jndi-name>jdbc/esoafds</jndi-name> | <connection-url>jdbc:mysql://192.168.1.2:3306/jbranch?useUnicode=true&characterEncoding=UTF8&autoReconnect=true</connection-url> | <driver-class>com.mysql.jdbc.Driver</driver-class> | <user-name>root</user-name> | <password></password> | <min-pool-size>3</min-pool-size> | <max-pool-size>100</max-pool-size> | <metadata> | <type-mapping>mySQL</type-mapping> | </metadata> | </local-tx-datasource> | </datasources> Please be aware that no "use-java-context" tag needed. web.xml <resource-ref> | <description>Esoaf DataSource</description> | <res-ref-name>jdbc/esoafds</res-ref-name> | <res-type>javax.sql.DataSource</res-type> | <res-auth>Container</res-auth> | </resource-ref> jboss-web.xml <jboss-web> | | <resource-ref> | <res-ref-name>jdbc/esoafds</res-ref-name> | <jndi-name>java:jdbc/esoafds</jndi-name> | </resource-ref> | | </jboss-web> Spring applicationContext.xml <bean id="dataSource" class="org.springframework.jndi.JndiObjectFactoryBean"> | <property name="jndiName" value="java:jdbc/esoafds"/> | </bean> Should I add "java:" before "jdbc/esoafds" or not? The second example can find correct JNDI name from JBoss, but it returns null from JNDI look up. Can any body give me a hint what's the concept difference between the two approaches? Why my example 1 works, but exmple 2 return null look up. Thanks a lot. View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4258569#4258569 Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4258569 _______________________________________________ jboss-user mailing list [email protected] https://lists.jboss.org/mailman/listinfo/jboss-user
