5 Replies Latest reply on Feb 3, 2010 2:54 PM by james_sutherland

    Insert the record using DB2 getting Error

    748179
      Hi

      i am inserting record using the Db2 geeting following error.

      com.ibm.db2.jcc.a.SqlException: DB2 SQL error: SQLCODE: -302, SQLSTATE: 22001, SQLERRMC: null


      I have A,b, and C tables, i am able to insert records in A and C.
      If Iam inserting record in C, iam getting following error.

      if aany one help on this Issue.

      regards
      Srini
        • 1. I need Hibernate.dilect equlant TopLinkJpa property
          748179
          Hi

          if any one help me Hibernate.dilect equlant TopLinkJpa property

          regards
          Srini
          • 2. Re: I need Hibernate.dilect equlant TopLinkJpa property
            648392
            Hi,

            Below is the equivalent of dialect in JPA and same should be added to persistence.xml.This will generate the SQL statements for create and Drop tables.

            <property name="eclipselink.ddl-generation"
            value="drop-and-create-tables"/>
            <property name="eclipselink.ddl-generation.output-mode" value="both"/>
            <property name="eclipselink.application-location"
            value="C:/BeaHome/5591_PS2/jdeveloper/mywork/Application2/Project1/src/META-INF/"/>
            <property name="eclipselink.table-qualifier" value="VIRAJ"/>
            <property name="eclipselink.create-ddl-jdbc-file-name"
            value="createDDL.jdbc"/>
            <property name="eclipselink.drop-ddl-jdbc-file-name"
            value="dropDDl.jdbc"/>

            Regards,
            Vinay
            • 3. Re: I need Hibernate.dilect equlant TopLinkJpa property
              648392
              Hi
              Below property sets the type of database to use.

              *+<property name="eclipselink.target-database" value="DB2"/>+*
              <property name="eclipselink.ddl-generation"
              value="drop-and-create-tables"/>
              <property name="eclipselink.ddl-generation.output-mode" value="both"/>
              <property name="eclipselink.application-location"
              value="C:/BeaHome/5591_PS2/jdeveloper/mywork/Application2/Project1/src/META-INF/"/>
              <property name="eclipselink.table-qualifier" value="VIRAJ"/>
              <property name="eclipselink.create-ddl-jdbc-file-name"
              value="createDDL.jdbc"/>
              <property name="eclipselink.drop-ddl-jdbc-file-name"
              value="dropDDl.jdbc"/>


              Regards,
              Vinay
              • 4. Re: I need Hibernate.dilect equlant TopLinkJpa property
                748179
                Taanks for reply,

                but i need to call the same in toplinlkjpa not eclipslinkjpa

                we are using the three database DB2 expecting the scheme name.

                If the scheme name define in _@Table (name="nyTable",schema="Myschema")_ working fine.
                If i define _<property name="topLinkJpa.jdbc.schema" value="mySchema" />_ in persistance.xml not wprking and getting the following error code
                DB2 SQL error: SQLCODE: -204, SQLSTATE: 42704, SQLERRMC: DB2ADMIN.testTable


                plese help me on this issue.
                • 5. Re: I need Hibernate.dilect equlant TopLinkJpa property
                  james_sutherland
                  What JPA version are you using exactly? TopLink Essentials?

                  There is no such property, "topLinkJpa.jdbc.schema". For most EclipseLink properties, if you replace eclipselink with toplink that was the property name on TopLink Essentials. But EclipseLink supports a lot more properties that TopLink Essentials, and I would strongly recommend upgrading to it.

                  You can try "toplink.table-qualifier" in TopLink Essentials, but I'm not sure if this was supported. You could you a SessionCustomizer to set the table qualifier on the Session's login if no property is available.

                  JPA does define a default schema property in the orm.xml as well, which perhaps you could use.

                  ---
                  James : http://www.eclipselink.org