3 Replies Latest reply on May 17, 2004 2:18 PM by Adrian Brock

    JBoss 3.2.2, problem with Oracle

    mdaffu Newbie

      The problem is (should be) very very simple, i have a connection pool in JBoss named OracleDS, yes it is an oracle8i connection pool, can i access this connection pool using a stateless session bean, if so , please send me the details

      I have a datasource named OracleDS, i am trying to access it from a stateless session bean

      in ejb-jar.xml

      <resource-ref>
      <res-ref-name>jdbc/DataSourceName</res-ref-name>
      <jndi-name>java:/OracleDS</jndi-name>
      </resource-ref>

      in oracle-ds.xml


      <local-tx-datasource>
      <jndi-name>OracleDS</jndi-name>
      <connection-url>jdbc:oracle:thin:@133.90.80.82:1522:chilebd</connection-url>
      <driver-class>oracle.jdbc.driver.OracleDriver</driver-class>
      <user-name>chile</user-name>
      chile
      </local-tx-datasource>


      I would appreciate any help you can give me on this question.

      Error like this:

      13:02:21,548 INFO [STDOUT] ***** Lookup *******
      java:comp/env/jdbc/jdbc-oracle
      13:02:21,548 INFO [STDOUT] ***** Data Source *******
      org.jboss.resource.adapter.jdbc.WrapperDataSource@b280b1
      13:02:21,564 ERROR [STDERR] java.sql.SQLException: Table not found: DUAL in statement [select INCONSISTENCIAS_SEQ.NEXTVAL FROM DUAL ]
      13:02:21,564 ERROR [STDERR] at org.hsqldb.Trace.getError(Unknown Source)
      13:02:21,564 ERROR [STDERR] at org.hsqldb.jdbcResultSet.(Unknown Sourc
      e)
      13:02:21,564 ERROR [STDERR] at org.hsqldb.jdbcConnection.executeStandalone(U

        • 1. Re: JBoss 3.2.2, problem with Oracle
          Adrian Brock Master

          There is no jndi-name in ejb-jar.xml
          There is one in jboss.xml

          • 2. Re: JBoss 3.2.2, problem with Oracle
            mdaffu Newbie

            Adrian,
            Thanks for the quick response
            my files are the following:

            ejb-jar.xml

            <ejb-jar>
             <enterprise-beans>
             <session>
             <display-name>SessionPKGen</display-name>
             <ejb-name>SessionPKGen</ejb-name>
             <home>pkgen.SessionPKGenHome</home>
             <remote>pkgen.SessionPKGen</remote>
             <ejb-class>pkgen.SessionPKGenBean</ejb-class>
             <session-type>Stateless</session-type>
             <transaction-type>Container</transaction-type>
             <resource-ref>
             <res-ref-name>jdbc/jdbc-oracle</res-ref-name>
             <res-type>javax.sql.DataSource</res-type>
             <res-auth>Container</res-auth>
             </resource-ref>
             </session>
             </enterprise-beans>
             <assembly-descriptor>
             <container-transaction>
             <method>
             <ejb-name>SessionPKGen</ejb-name>
             <method-name>*</method-name>
             </method>
             <trans-attribute>Required</trans-attribute>
             </container-transaction>
             </assembly-descriptor>
            </ejb-jar>
            


            jboss.xml
            <jboss>
             <enterprise-bean>
             <session>
             <ejb-name>SessionPKGen</ejb-name>
             <jndi-name>SessionPKGen</jndi-name>
             <resource-ref>
             <res-ref-name>jdbc/jdbc-oracle</res-ref-name>
             <jndi-name>java:/OracleDS</jndi-name>
             </resource-ref>
             </session>
             </enterprise-bean>
            </jboss>
            


            oracle-ds.xml

            datasources>
             <local-tx-datasource>
             <jndi-name>OracleDs</jndi-name>
             <connection-url>jdbc:oracle:thin:@133.90.80.82:1522:chilebd</connection-url>
             <driver-class>oracle.jdbc.driver.OracleDriver</driver-class>
             <user-name>chile</user-name>
             <password>chile</password>
             </local-tx-datasource>
            </datasources>
            
            


            code
            
             try
             {
             InitialContext ic = new InitialContext();
             ds = (DataSource) ic.lookup("java:comp/env/jdbc/jdbc-oracle");
            
             c = ds.getConnection();
            
             ps = c.prepareStatement(OBTENER_SECUENCIA,
             ResultSet.TYPE_SCROLL_INSENSITIVE,
             ResultSet.CONCUR_READ_ONLY);
            
             rs = ps.executeQuery();
             rs = ps.executeQuery();
             rs.next();
             id = rs.getBigDecimal(1);
             rs.close();
             ps.close();
             }
            
            


            • 3. Re: JBoss 3.2.2, problem with Oracle
              Adrian Brock Master

              There is also no enterprise-bean in jboss.xml
              there is an enterprise-beans

              I added your question to the FAQ