4 Replies Latest reply on Jun 23, 2007 7:33 AM by alexrozario

    Database Connection

    alexrozario

      hi,
      i am doing ejb 3.0 project in exadel eclipse IDE. i am using JBOSS server to run my application.

      well. now i need to connect my project with oracle database, i have created a database connection in database explorer. now how can i connect this database in my project. and how can i use the tables in my entity bean.

      please help me.

      i am waiting for your response.

      thanks in advance.

        • 1. Re: Database Connection
          waynebaylor

          There are several things you need to check:

          1) copy oracle-ds.xml from jboss/docs/examples/jca to jboss/server/xxx/deploy (edit the client connection and user/pass fields).
          2) make sure your persistence.xml file specifies Oracle as the datasource.
          3) download ojdbc14.jar and put it in jboss/server/xxx/lib (has Oracle drivers).


          • 2. Re: Database Connection
            alexrozario

            Thank you sir.
            thank you for your valuable response..
            i have followed the things you have specified..

            now i am in a right path i think, but still i cant finish my task.
            i cant connect with database.

            can you help me further.

            i have created an entity bean as First.java(i have table named First in my remote database). i have created FirstEjb as remote interface and created FirstEjbBean as stateless session bean. my oracle jndi name is oracle..

            but

            while ruinning the server it shows the following error.

            ObjectName: persistence.units:ear=New.ear,jar=NewEJB.jar,unitName=First
            State: FAILED
            Reason: javax.naming.NameNotFoundException: Oracle not bound
            I Depend On:
            jboss.jca:service=ManagedConnectionFactory,name=Oracle
            Depends On Me:
            jboss.j2ee:ear=New.ear,jar=NewEJB.jar,name=FirstEjb,service=EJB3


            <persistence-unit name="First">
            <jta-data-source>Oracle</jta-data-source>
            </persistence-unit>

            this is my persistence file.. i think i have to change here only..

            i am in confused state..

            can you please guide me to overcome this issue..

            thank you sir..

            • 3. Re: Database Connection
              andydale

              Hi

              you're right, a chage is needed in the persistence file: change the following

              <jta-data-source>Oracle</jta-data-source>


              to

              <jta-data-source>java:/Oracle</jta-data-source>


              Cheers,

              Andy

              • 4. Re: Database Connection
                alexrozario

                Thank you for your timely help andydale.

                Sorry for my belated reply.