1 Reply Latest reply on May 26, 2010 11:36 AM by Peter Johnson

    A Simple JNDI question

    Rickard Engström Newbie

      Hi

       

      For most of you this probably is basic stuff, but I need som advice to straighten this out since I'm quite new to JBoss (worked more w Tomcat).
      I have some data sources (MS Sql 2000) which I've defined in mssql-ds.xml which I then put inside the deploy folder (default by the way). And I have references to these JNDI resources in both web.xml and jboss-web.xml. Is this the correct way of doing it? Or can I simply drop web.xml....? I know that if I have web.xml I need to have the same references in both, at least I need that with current setup, otherwise JBoss will throw a "complaint" during startup, the

      As it is right now everthing is running fine but I want to understand things, not only having things working, and know If I do it the correct way.

       

      So, the main question, which is the best (or maybe even the only) way of setting up data sources with JNDI in JBoss?

      I'm using JBoss EAP 4.3 (AS) and no ejb's are used, but Hibernate though.

      And one more thing, is connection pooling automaticly used if I don't explicitly configure it to be used?
      (At the end is my mssql-ds)

       

      Cheers

      /Rickard

       

      <?xml version="1.0" encoding="UTF-8"?>

       

      <datasources>

       

      <local-tx-datasource>
          <jndi-name>MSSQLDS_####</jndi-name>
          <connection-url>jdbc:sqlserver://###.###.###.###:1433;DatabaseName=db_###</connection-url>
          <driver-class>com.microsoft.jdbc.sqlserver.SQLServerDriver</driver-class>
          <user-name>username</user-name>
          <password>password</password>
            <metadata>
               <type-mapping>MS SQLSERVER2000</type-mapping>
            </metadata>
        </local-tx-datasource>

       

        <local-tx-datasource>
          <jndi-name>MSSQLDS_########_####</jndi-name>
          <connection-url>jdbc:sqlserver://###.###.###.###:1433;DatabaseName=db_##########</connection-url>
          <driver-class>com.microsoft.jdbc.sqlserver.SQLServerDriver</driver-class>
          <user-name>username2</user-name>
          <password>password2</password>

            <metadata>
               <type-mapping>MS SQLSERVER2000</type-mapping>
            </metadata>
        </local-tx-datasource>

       

      </datasources>