1 Reply Latest reply on Apr 5, 2002 9:23 AM by Chris Harris

    MS SQL Server Config on NT

    katakyie Newbie

      I need to configure Jboss2.4.4_Tomcat4.0.1 to access a database ( MS SQL Server 7.0 ) using a tds driver on Windows NT. Already I have done the following:

      1. I made a tds.jar containing the driver.
      2. I copied the tds.jar into <path_to_jboss>lib\ext
      3. I edited the jboss.jcml files in
      <path_to_jboss>conf\default and
      <path_to_jboss>conf\catalina
      Under the JDBC Section, i inserted the following tags.


      com.inet.tds.TdsDriver
      jdbc:inetdae:myIPName:1433?database=kweb;sql7=true
      user
      password


      When I run Jboss, I can read the following

      ...
      [INFO,JdbcProvider] Initializing
      [INFO,JdbcProvider] Loaded JDBC-driver:org.hsqldb.jdbcDriver
      [INFO,JdbcProvider] Loaded JDBC-driver:com.inet.tds.TdsDriver
      [INFO,JdbcProvider] Initialized
      ...

      So far, so good !
      The question is how do I proceed further?
      Please help ?

      kat.

        • 1. Re: MS SQL Server Config on NT
          Chris Harris Newbie

          The JDBCProvider is simply to load JDBC drivers - you only need to supply the driver class names you want to use in your server, separated by commas. So for your config, you don't need the lines for URL, Password, JDBCUser etc.

          These extra lines go into your datasource configuration, which tells JBoss how to create connections using the driver. Look in your jcml file for something beginning with



          and edit the properties under there. Note that since this mbean represents the DefaultDS datasource, it is set up to use Hypersonic by default. By editing this mbean configuration you would be *replacing* the default datasource for that instance of JBoss. You can, if you like, copy the configuration and change the 'name=DefaultDS' to e.g. 'name=MyDS' to create a second datasource - preserving the original one. You would also need to change the PoolName attribute appropriately.

          Then you need to add properties to that datasource to get it to run. We use SQL 2000 here and we set it up as follows:


          DefaultDS
          com.inet.tds.XDataSource
          my.db.username
          my.db.password
          false
          host=my.db.ip.address;database=my.sql.database.name
          1200000
          20
          false
          false
          false
          true
          120000
          1800000
          false
          1.0
          0


          Notes: this uses the tds datasource object which will do proper XA transactions (i.e. will coordinate with other resource managers across transaction boundaries). I've only managed to get this to work with the Tyrex transaction manager - your mileage may vary. If you can't get it to work then fall back to the jboss XADataSourceImpl class which is a 'fake-XA' implementation. It may be enough for your needs.

          Of course you may not need XA transactions at all - in which case you need to set up a non-XA datasource. I can't help you there.

          Once you get this set up, look up your datasource in JNDI under e.g. java:/DefaultDS - this is a java.sql.DataSource which you can use to get JDBC connections etc.