2 Replies Latest reply on Jul 30, 2003 10:06 PM by thudacko

    Configure to MS SQL Server 6.5

    rfeenstr Newbie

      I'm new to JBoss, and attempting to connect it to our MS SQL Server 6.5 database. I'm following the great examples from the O'Reilly JBoss Workbook, appendix A (simple example).

      JBoss: jboss-3.2.1_tomcat-4.1.24
      OS: Win2K
      JDBC Driver: JSQLConnect 2_26

      I modified the titandb-ds.xml file, using the examples\jca mssql-ds.xml example, as below, and deployed to the deploy directory:

      <local-tx-datasource>
      <jndi-name>MSSQLDS</jndi-name>
      <connection-url>jdbc:microsoft:sqlserver://QA_DATABASE:1433;DatabaseName=qa_customers</connection-url>
      <driver-class>com.jnetdirect.jsql.JSQLDriver</driver-class>
      <user-name>uname</user-name>
      pw
      </local-tx-datasource>




      And finally, my jbosscmp-jdbc.xml stuff (I don't know what to put for the datasource-mapping tag, thus the -????- here):
      <jbosscmp-jdbc>


      java:/MSSQLDS
      <datasource-mapping> -????- </datasource-mapping>
      <create-table>false</create-table>
      <remove-table>false</remove-table>


      <enterprise-beans>

      (snip)

      </enterprise-beans>
      </jbosscmp-jdbc>



      I have copied the JDBC driver jar (JSQLConnect.jar) into jboss\server\default\lib directory. And this jar file is in my classpath too.

      Other than the table definition and the JDBC driver, everything else is as in the O'Reilly Appendix A example. The -ds.xml file has also been copied to the deploy directory.

      When deploying my application jar, JBoss throws the following exception:
      [ObjectName: jboss.j2ee:jndiName=StatesHomeRemote,service=EJB
      state: FAILED
      I Depend On:
      Depends On Me: org.jboss.deployment.DeploymentException: Error in jbosscmp-jdbc
      .xml : datasource-mapping -????- not found]

      Of course, -????- is just for this post. I've tried several different values (MSSQL, MS SQLServer, etc.), to no avail. The O'Reilly example just puts "Oracle8" there, without explaining why (simple example).

      I'm sure I'm missing some step, some linking XML file between JBoss and my JDBC driver, or something. I just don't know what, yet.

      Thanks in advance,
      Rick

        • 1. Re: Configure to MS SQL Server 6.5
          thudacko Newbie

          You wrote:

          >>Of course, -????- is just for this post. I've tried
          several different values (MSSQL, MS SQLServer, etc.), to no avail. The O'Reilly example just puts "Oracle8" there, without explaining why (simple example).

          Coincidentally, I also am trying the same workbook example with MS SQL Server and had/have the same problem.

          I can only provide part of the answer. The string "Oracle8" as the datasource-mapping provided by the example you cited should refer to valid type-mapping by that same name that defines the jdbc/Java/Oracle native types mapping. Unfortunately, we are not given the named Oracle8 type-mapping (or I simply cannot find it). This should be defined in the jboss-3.2.1/server/default/conf/standardjbosscmp-jdbc.xml file. If you examine this file, you will see that there is a type-mapping named "Hypersonic SQL" further down in the file. There should be a similar mapping for Oracle8 in order for the example to work (using Oracle). Same goes for what other db you may decide to use, such as MSSQLDS

          Alternatively, it seems possible that the dataset-mapping could be defined in the example's src/resources/META-INF/jboss-jdbc.xml file, but I am not certain of this.

          Does anyone know of a library of valid type-mappings anyone is sharing? Otherwise, this will be trial and error to obtain a type-mapping that works.

          See p. 625-630 of the JBossBook_321.pdf (the $10 purchase) for more info.

          • 2. Re: Configure to MS SQL Server 6.5
            thudacko Newbie

            Here's the rest of the answer:

            Read further to page 627, section on "Datasource Configuration":

            "JBossCMP includes predefined type-mappings for many databases including:... MS SQLSERVER, MS SQLSERVER 2000, ..."


            There you have it. Pick the one appropriate to the version of the db you are running.