1 Reply Latest reply on Jan 5, 2005 1:04 PM by abcolson

    Data Type Mapping

    abcolson Newbie

      Greetings List,

      I am using jboss-4.0.0RC2 with MS Access. I had to create my own mappings in standardjbosscmp-jdbc.xml (If anyone knows of one that already exists that may solve alot of my problems).

      In the type mapping I have the defaults set up as

       <datasource-mapping>MS ACCESS</datasource-mapping>
       <entity-command name="default"/>

      and in the type mapping section I have

       <name>MS ACCESS</name>

      Additionally, my msaccess-ds.xml file is


      <!-- format of URL is "jdbc:odbc:DSNNAME" -->

      <connection-property name="SelectMethod">cursor</connection-property>



      <!-- corresponding type-mapping in the standardjbosscmp-jdbc.xml (optional) -->
      <type-mapping>MS ACCESS</type-mapping>


      Upon startup I get the following error

      18:31:48,640 ERROR [EntityContainer] Starting failed jboss.j2ee:jndiName=ejb/UserLocal,service=EJB
      org.jboss.deployment.DeploymentException: Error while creating table complianceproject; - nested throwable: (java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] Size of field 'name' is too long.)

      Looking in the odbc log I see

      tools.jar org.j e7c-878 EXIT SQLExecDirect with return code -1 (SQL_ERROR)
      HSTMT 04F42960
      UCHAR * 0x03F31410 [ -3] "CREATE TABLE complianceproject (name VARCHAR(256), deadline TIMESTAMP, instructions VARCHAR(256))\ 0"
      SDWORD -3

      DIAG [37000] [Microsoft][ODBC Microsoft Access Driver] Size of field 'name' is too long. (-1506)

      My question is why is this happening? It appears that I have set the max to be 255. Where else could the 256 be coming from?


        • 1. Re: Data Type Mapping
          abcolson Newbie

          Here is a new twist.

          The reason my java.lang.String gets mapped to VARCHAR(256) and not VARCHAR(255) is because of some sort of Hypersonic dependancy, i.e. JBoss is pulling VARCHAR(256) mapping from the Hypersonic mappings instead of VARCHAR(255) from the MS ACCESS mapping.


          1) I removed all the type-mapping elements from standardjbosscmp-jdbc.xml except for MS ACCESS...the result was a burp when JBoss tried to create my complianceproject table upon startup which complained about Hypersonic errors.

          2) I then added back in the Hypersonic type-mapping into standardjbosscmp-jdbc.xml and changed the java.lang.String mapping from VARCHAR(256) to VARCHAR(255)...the table was created fine.

          The question of the day is: Why is this happening?

          Where else does JBoss get db mapping information from? I removed standardjaws.xml (What is this for anyways?) from the conf directory and my table was still created fine.

          Any insight is appreciated.