在jboss下有docs\examples\jca目录下有相应数据库链接信息的配置文档,拿出来改一下,然后COPY到你的JBOSS中的server\default\deploy下面,从后台看打出的JNDI名称

解决方案 »

  1.   

    jboss自带了例子的,你把它的对应的xml文件改改就ok了
      

  2.   

    从后台看打出的JNDI名称
    是什么意思?
      

  3.   

    放在ejb-jar.xml和jboss.xml中。就象下面这样(来自xpetstore):
    ejb-jar.xml中         <resource-ref >
                <res-ref-name>jdbc/xpetstore</res-ref-name>
                <res-type>javax.sql.DataSource</res-type>
                <res-auth>Container</res-auth>
             </resource-ref>jboss.xml中         <resource-ref>
                <res-ref-name>jdbc/xpetstore</res-ref-name>
                <jndi-name>java:/xpetstoreDS</jndi-name>
             </resource-ref>
      

  4.   

    忘了一点,使用它的方法是这样的:DataSource  ds = ( DataSource ) ic.lookup( "java:comp/env/jdbc/xpetstore");
      

  5.   

    看看这里的对应文档,应该就没问题了。
    http://www.huihoo.org/jboss/index.html