4 Replies Latest reply on Jul 28, 2008 5:00 PM by peterj

    Connecting to a database through named instance,mssql-ds.xml

    srawan

      how to connect to database through named insatnce SQL SERVER from jboss msql-ds.xml jndi

        • 1. Re: Connecting to a database through named instance,mssql-ds
          jaikiran

          Which driver do you use? Is it Microsoft driver or is it the jTDS driver?

          • 2. Re: Connecting to a database through named instance,mssql-ds
            jdriver

            I have the same question. I have an app written to Hypersonic and now need to translate the db configs to use SQL Server 2005 with jdts.

            I have the following config but getting an error in the mbean code="org.jboss.jdbc.SQLServerDatabase" line. I just guessed at that. It used to say HypersonicDatabase:



            <local-tx-datasource>
            <jndi-name>myDS</jndi-name>
            <connection-url>jdbc:jtds:sqlserver://mymachine:1433/mydb</connection-url>
            <driver-class>net.sourceforge.jtds.jdbc.Driver</driver-class>
            <user-name>sa</user-name>
            mypass
            <min-pool-size>5</min-pool-size>
            <max-pool-size>20</max-pool-size>
            <idle-timeout-minutes>0</idle-timeout-minutes>
            <track-statements/>

            <type-mapping>SQL Server</type-mapping>

            jboss:service=MSSQL-db,database=mydb
            </local-tx-datasource>


            1701
            true
            mydb
            false
            true



            • 3. Re: Connecting to a database through named instance,mssql-ds
              jdriver

              Going to try and post the code again:

              <datasources>
              
               <local-tx-datasource>
               <jndi-name>myDS</jndi-name>
               <connection-url>jdbc:jtds:sqlserver://mymachine:1433/MYDB</connection-url>
               <driver-class>net.sourceforge.jtds.jdbc.Driver</driver-class>
               <user-name>sa</user-name>
               <password>mypass</password>
               <min-pool-size>5</min-pool-size>
               <max-pool-size>20</max-pool-size>
               <idle-timeout-minutes>0</idle-timeout-minutes>
               <track-statements/>
               <metadata>
               <type-mapping>SQL Server</type-mapping>
               </metadata>
               <depends>jboss:service=MSSQL-db,database=mydb</depends>
               </local-tx-datasource>
              
               <mbean code="org.jboss.jdbc.SQLServerDatabase"
               name="jboss:service=MSSQL-db,database=mydb">
               <attribute name="Port">1701</attribute>
               <attribute name="Silent">true</attribute>
               <attribute name="Database">labordb</attribute>
               <attribute name="Trace">false</attribute>
               <attribute name="No_system_exit">true</attribute>
               </mbean>
              
               </datasources>
              



              • 4. Re: Connecting to a database through named instance,mssql-ds
                peterj

                You do not need that MBean - that was for Hypersonic only, and then only if running it as a service. Look at the example *-ds.xml file in docs/examples/jca, there is one there for SQL Server.