6 Replies Latest reply on Oct 12, 2001 5:18 AM by sbsenjboss

    JBoss with Interbase problems.

    pibakic

      Hi,

      Im looking into migrating some EJB's (BMP entity beans) that I use from Oracle 8i to Interbase (ver. 6.0 I use at the moment), but have encountered a lot of problems.

      Im using Jboss 2.5 alpha with Interbase 6.0, and the InterClient 2.0 JDBC client. Everything runs fine until I try to write data into a blob, where I get a;

      invalid transaction handle (expecting explicit transaction start)

      error (I can post more specifics if your interested).

      If anyone could help me with this specific error then that would be much appreciated, but Id also like to know if *anyone* has succesfully written any BMP entity beans which run (stable!) on Jboss (2.2, 2.4 or, preferably 2.5 alpha) using InterBase through any JDBC (although the only one Im aware of is InterClient - flakey ;o)), just to see if its do-able.


      Thanks in advance,

      Pib.

        • 1. Re: JBoss with Interbase problems.
          sdedonatis

          Hi,
          I also have the same problem with blobs in CMP Beans(using jboss 2.2.2, interbase 6.01 and interclient 2.0), however i had some success when i want to store a large string in a BLOB SUB_TYPE TEXT using this mapping for the cmp-field in jaws.xml:
          <sql-type>BLOB</sql-type>
          <jdbc-type>JAVA_OBJECT</jdbc-type>

          • 2. Re: JBoss with Interbase problems.
            pibakic

            Thanks for your help, but a couple of questions;

            Do you mean standard-jaws.xml? The type-mapping config file (Im fairly certain you must, can't think what else it would be).

            Secondly, the <java-type> attribute is missing? I presume its a "String" but not really sure,

            Thanks,

            Pib.

            • 3. Re: JBoss with Interbase problems.
              sdedonatis

              no, i meant the jaws.xml file that is in the META-INF subdirectory with the jboss.xml and the ejb-jar.xml.
              jboss uses this file to override the default mappings.
              in this file you can specify a custom database mapping or the mapping of every bean.
              in my jaws.xml is:

              <?xml version="1.0" encoding="Cp1252"?>

              java:/cywDS
              <type-mapping>InterBase</type-mapping>
              ...
              <enterprise-beans>
              ...

              <ejb-name>FichaInterna</ejb-name>
              <table-name>FichaInterna</table-name>
              <create-table>false</create-table>
              <cmp-field>
              <field-name>propietario</field-name>
              <column-name>propietario</column-name>
              <sql-type>VARCHAR(255)</sql-type>
              <jdbc-type>VARCHAR</jdbc-type>
              </cmp-field>
              <cmp-field>
              <field-name>observaciones</field-name>
              <column-name>observaciones</column-name>
              <sql-type>BLOB</sql-type>
              <jdbc-type>JAVA_OBJECT</jdbc-type>
              </cmp-field>

              <cmp-field>
              <field-name>id</field-name>
              <column-name>id</column-name>
              <sql-type>INTEGER</sql-type>
              <jdbc-type>INTEGER</jdbc-type>
              </cmp-field>

              </enterprise-beans>

              being the observaciones a public String field in the EBJ.

              hope that help.

              • 4. Re: JBoss with Interbase problems.
                sdedonatis

                I think i found the glitch !
                The problem is that the default container configuration standardjboss.xml has a <commit-option>A</commit-option>(that means caching the state).
                I changed it to B (caching the state but making ejbload before) and it worked with a byte[] field stored in a BLOB column. I use it to store an image the database; so i made a container-configuration in jboss.xml and i use it only for the beans that have blob fields.

                Although i haven't testet it thoughtfully.

                • 5. Re: JBoss with Interbase problems.
                  pibakic

                  Thanks mate, you are a genius! After changing this setting I have encountered no problems at all using JBoss with Interbase,

                  Thanks again for your help,

                  Pib.

                  • 6. Re: JBoss with Interbase problems.
                    sbsenjboss

                    Hi,

                    I am new to JAVA, can any one help me.

                    I have a EJB class which I deploy in JBOSS with INTERBASE back end.

                    Now I establish the connection in the EJB class itself and call a Stored Procedure and convert the Result Set in to XML and receive in the client. There are many method in the EJB class do the same.

                    In order to get connection pooling.

                    What I have to add to
                    jboss.jcml

                    Do I need, What I have to add in this file
                    InterBasedb.properties

                    What I have to add to
                    jaws.xml

                    how I have to use this in my EJB class?

                    pl help me sample EJB class code is below

                    thanks in advance
                    sbsen.


                    *************************
                    public class AgentEJB implements SessionBean {
                    String jdbcURL = "jdbc:interbase://localhost/D:/Sportstech.gdb";
                    Connection conn;
                    Statement statement;
                    ResultSet resultSet;
                    ResultSetMetaData resultSetMetaData;
                    CallableStatement callableStatement;
                    Element output;

                    public AgentEJB(){
                    try{
                    Class.forName("interbase.interclient.Driver");
                    conn = DriverManager.getConnection(jdbcURL,"SYSDBA", "masterkey");
                    statement = conn.createStatement();
                    }
                    catch(Exception e){
                    e.printStackTrace();
                    }
                    }

                    public Element getDuplicateAgentCode(Element DuplicateAgentCode) {
                    try {
                    String astoredProcedure = "select * from SP_CHECKDUPLICATEAGENTCODE(?)";
                    callableStatement = conn.prepareCall(astoredProcedure);
                    callableStatement.setString(1, DuplicateAgentCode.getAttributeValue("VCAGENTCODE"));
                    resultSet = callableStatement.executeQuery();
                    this.getEJBElement(resultSet);
                    }
                    catch (SQLException se) {
                    se.printStackTrace();
                    }
                    return output;
                    }

                    /** Empty method body
                    */
                    public void ejbCreate() {}
                    /** Empty method body
                    */
                    public void ejbRemove(){}
                    /** Empty method body
                    */
                    public void ejbActivate() {}

                    public void setSessionContext(SessionContext ctx) {}

                    public void ejbPassivate() {}

                    }