4 Replies Latest reply on Dec 13, 2001 6:30 PM by matthicksj

    Please help with SQL Server 2000 Mapping

    matthicksj

      I am getting an error running the CMP 2.0 EJB tests with SQL Server 2000 and jboss3.0 using the Microsoft JDBC Driver. All of the tables get created and the column names that do not have specified types get mapped to BigInt(8). Also, populating the tables works. However, on any calls that return objects from the database, SQLExceptions are thrown. This is an example from the server log of a call that failed (the ORDER_NUMBER column is of type BigInt(8)):

      [2001-12-13 01:10:36,640,CMP,DEBUG] findAll command executing: SELECT t1_o.ORDER_NUMBER FROM ORDER_DATA t1_o
      [2001-12-13 01:10:36,640,MSSQL2000DS,DEBUG] Pool MSSQL2000DS created a new object: org.jboss.resource.adapter.jdbc.local.JDBCManagedConnection@ab6c1c
      [2001-12-13 01:10:36,656,MSSQL2000DS,DEBUG] Pool MSSQL2000DS [0/5/10] destroyed object org.jboss.resource.adapter.jdbc.local.JDBCManagedConnection@7a140f.
      [2001-12-13 01:10:36,656,CMP,DEBUG] java.sql.SQLException: [Microsoft][SQLServer JDBC Driver]Unhandled data type: TDS_INT8
      [2001-12-13 01:10:36,656,Default,ERROR] java.sql.SQLException: [Microsoft][SQLServer JDBC Driver]Unhandled data type: TDS_INT8
      [2001-12-13 01:10:36,656,Default,ERROR] at com.microsoft.jdbc.base.BaseExceptions.getException(Unknown Source)

      Could anyone please give me some direction as to how to change the type mappings or explain to me what is happening? Thank you very much

        • 1. Re: Please help with SQL Server 2000 Mapping
          alex_koshterek

          This driver have bug in working with BIG_INT8.
          Check nntp server msnews.microsoft.com
          There exists group about this driver

          • 2. Re: Please help with SQL Server 2000 Mapping
            matthicksj

            On the newsgroup they suggested the use of 'long' to handle the BIGINT values. However, the mapping already looks like this. I am not sure if this attempts to do what they suggested on the newsgroup:


            <java-type>java.lang.Long</java-type>
            <jdbc-type>BIGINT</jdbc-type>
            <sql-type>BIGINT</sql-type>


            Also, how do we change the defaults for the CMP fields? For instance, how could I change the default value of BIGINT(8) to INT or something when the tables are created? Thanks

            • 3. Re: Please help with SQL Server 2000 Mapping
              alexnet

              Hi,
              there is a bug in MS drivers. If you change your type of your column to nullable, everything should be fine. Errors occurs only if column has type 'Long' and declare as 'NOT NULL'.

              Alex.

              • 4. Re: Please help with SQL Server 2000 Mapping
                matthicksj

                Great - thank you very much for your replies. I was able to change the code to have the primary key's use int's as opposed to Long's. One thought I had though, would it work just to map the Long datatype to the FLOAT JDBC type as opposed to the BIGINT type - they are both 8 byte values.

                Thanks