about connect with oracle database

Discussions

EJB design: about connect with oracle database

  1. about connect with oracle database (4 messages)

    Where can I download the tutorial about "How to write EJB Entity Bean CMP/BMP to connect with Oracle Database."

    Thank.
  2. You probably won't find an article of that nature since, at least for CMP Entity Beans, the underlying database is abstracted and not specific in any way to your implementation. You simply need to configure declerative mappings in your deployment descriptors properly and you should have no problem using CMP Entity Beans with Oracle, or any other database.

    For BMP Entity beans, you will need to code all persistence and query logic manually. I recommend using a DAO and ConnectionFactory pattern when taking this approach as to avoid placing any database/vendor-specific code in your entity beans.

    For tutorials that might assist you in learning the basic of CMP/BMP Entity beans, refer to the following link..

    http://java.sun.com/j2ee/tutorial/1_3-fcs/

    Hope it helps,

    SAF
  3. Hmm... Thank you.
    But when I want to setup the DataSource. I must specify the JDBC Driver(the default have 2 drivers > db2,idb...)
    When I click add the driver to specify the Oracle JDBC driver.I don't know the data to enter in the textbox.
  4. What you can do is check your datasource entry:
    I think what you are looking for is the DB URL

    It should be of the format:
    jdbc:oracle:thin:@localhost:1521:mydatabase
    where
    localhost is the hostname of your database server.
    1521 is the standard port for db connection
    mydatabase is the database name (which you will be using for your application)

    This should work. Your full datasource entry should look like this:

    <datasources>
        <jdbc name="MyConnectionName">
          <pool-controller min="5" max="10"/>
          <dburl>jdbc:oracle:thin:@localhost:1521:mydatabase</dburl>
          <user>mylogin</user>
          <password>myPassword</password>
        </jdbc>
        <j2ee name="MyJ2eeConnection">
          <dbname>someDB</dbname>
        </j2ee>
      </datasources>
  5. If you want to use reference sources, check out otn.oracle.com
    go to the Java section. But most of the whitepapers talks about deploying on Oracle database and Oracle Application server. Not sure if it's helpful to you