5 Replies Latest reply on Jan 11, 2002 1:17 PM by markd

    can not connect to oracle

    sunhongfeng

      Hi Dear all,
      I try to connect to oracle in Jboss2.4. I do the following to set the the oracle pool:
      1. copy classes12.zip to lib/ext
      2.add "jboss.xa.xidclass=oracle.jdbc.xa.OracleXid" in jboss.properties
      3. add "
      oracle.jdbc.driver.OracleDriver..."


      4. Add <mbean code="org.jboss.jdbc.XADataSourceLoader" ... in jboss.jcml.

      I do that as the instruction in http://www.jboss.org/documentation/HTML/ch03s09.html.


      but when i start jboss2.4, it can not pick up oracle. nothing happen.

      does anyone has idea?
      thank in advance.



        • 1. Re: can not connect to oracle
          ektarani

          I am facing the same problem. I am new to jboss. Was trying to configure oracle but could not. Can somebody let me know as how to go about it?

          • 2. Re: can not connect to oracle
            juergenheidak

            What do you mean by "it can not pick up oracle, nothing happen": errors or warnings or is jboss unable to start ... ???

            Give more information, if useful add parts of the jboss output.

            • 3. Re: can not connect to oracle
              markd

              Here are the lines from my jboss.jcml for Jboss-2.4.3 for Oracle. I did NOT add the OracleXid line to JBoss properties.


              org.hsqldb.jdbcDriver,oracle.jdbc.driver.OracleDriver


              <!-- code for oracle -->

              OracleDB
              org.jboss.pool.jdbc.xa.wrapper.XADataSourceImpl
              jdbc:oracle:thin:@localhost:1521:test1
              userid
              password
              75
              true
              false
              true
              true
              120000
              4000
              4000
              true
              false
              1.0
              5

              • 4. Re: can not connect to oracle
                otcons

                I did as Markd said, but I get the message in the message:

                ERROR in getConnection or in executeQuery

                and in the jbosserror the message

                [ERROR,Default] SQLException: listaPool not bound

                this is part of my jboss.jcml:

                <!-- ======================= -->
                <!-- JDBC -->
                <!-- ================================= -->


                org.hsqldb.jdbcDriver,oracle.jdbc.driver.OracleDriver



                1476
                true
                default
                false



                listaPool
                <!-- org.opentools.minerva.jdbc.xa.wrapper.XADataSourceImpl -->
                org.jboss.pool.jdbc.xa.wrapper.XADataSourceImpl
                jdbc:oracle:thin:@pippo:1521:ORCL
                pluii
                sssss
                75
                true
                false
                true
                true
                120000
                4000
                4000
                true
                false
                1.0
                5


                This is my jboss.xml:

                <?xml version="1.0" encoding="UTF-8"?>

                false
                <container-configurations />

                <resource-managers>

                <resource-manager res-class="org.jboss.ejb.deployment.JDBCResource">
                <res-name>jdbc/lista</res-name>
                <res-jndi-name>java:/listaPool</res-jndi-name>
                </resource-manager>

                </resource-managers>

                <enterprise-beans>

                <ejb-name>Elencoiscritticognomi1</ejb-name>
                <jndi-name>esame/Elencoiscritticognomi1</jndi-name>
                <resource-ref>
                <res-ref-name>jdbc/lista</res-ref-name>
                <resource-name>jdbc/lista</resource-name>
                </resource-ref>

                </enterprise-beans>





                this my ejb-jar.xml:

                <?xml version="1.0" encoding="UTF-8"?>


                <ejb-jar>
                Data Sample Application
                <display-name>data EJB</display-name>
                <enterprise-beans>

                <ejb-name>Elencoiscritticognomi1</ejb-name>
                esame.Elencoiscritticognomi1Home
                esame.Elencoiscritticognomi1
                <ejb-class>esame.Elencoiscritticognomi1Bean</ejb-class>
                <session-type>Stateless</session-type>
                <transaction-type>Container</transaction-type>
                <resource-ref>
                DataSource per Elencoiscritticognomi1
                <res-ref-name>jdbc/lista</res-ref-name>
                <res-type>javax.sql.DataSource</res-type>
                <res-auth>Container</res-auth>
                </resource-ref>

                </enterprise-beans>
                <assembly-descriptor>
                <container-transaction>

                <ejb-name>Elencoiscritticognomi1</ejb-name>
                <method-name>*</method-name>

                <trans-attribute>NotSupported</trans-attribute>
                </container-transaction>
                </assembly-descriptor>
                </ejb-jar>

                and in the Bean I use:

                DataSource ds=(DataSource)jndiContext.lookup("java:comp/env/jdbc/lista");

                • 5. Re: can not connect to oracle
                  markd

                  Here is my ref in ejb-jar.xml:
                  <resource-ref>
                  <res-ref-name>java:/OracleDB</res-ref-name>
                  <res-type>javax.sql.DataSource</res-type>
                  <res-auth>Application</res-auth>
                  </resource-ref>

                  Here is the code to reference it in a SLSB:

                  Context sessionBeanContext = new InitialContext();
                  DataSource ds = (DataSource) sessionBeanContext.lookup("java:/OracleDB");

                  Is is possible that your datasource is not being created because you do not have classes12.zip in your classpath?

                  Very early in your log file your should see a message like this:
                  [OracleDB] XA Connection pool OracleDB bound to java:/OracleDB