2 Replies Latest reply on Sep 18, 2002 3:57 PM by Thomas Diesler

    Definitive guide to seting up oracle datasource?

    Edward Barron Newbie

      Ok, I've looked throughout this forum, and the
      one thing I cannot find are good instructions for
      how to setup an oracle 9i datasource for use w/jdbc
      in JBoss 3.0.

      I see a lot of people asking, but I just can't find the definitive "This is how it's done" message.

      Would anyone mind givine me a quick (idiot proof!) guide?


        • 1. Re: Definitive guide to seting up oracle datasource?
          Lars-Inge Tønnessen Newbie

          I don't know if this is an idiot proof guide, but this is how I got it (JBoss 3 & Oracle 9i) working. =:o)

          1. Copy the "classes12.jar" from "oracle/ora90/jdbc/lib" to the "jboss/server/default/lib" catalog. (the Oracle JDBC driver)

          2. Copy the "nls_charset12.jar" from "oracle/ora90/jdbc/lib" to the "jboss/server/default/lib" catalog. (Oralce language package)

          3. Copy the "ocrs12.jar" from "oracle/ora90/jdbc/lib" to the "jboss/server/default/lib" catalog. (don't remember)

          4. Copy the "jboss/docs/examples/jca/oracle-service.xml" file into the "jboss/server/default/deploy" catalog.

          5. Edit the file "jboss/server/default/deploy/oracle-service.xml":
          In the "OracleRealm" block

          In the "ManagedConnectionFactoryProperties" block:
          <config-property name="ConnectionURL" type="java.lang.String">jdbc:oracle:thin@localhost:1521:yourDB</configure-property>

          localhost = your host (IP or DNS name) where you are running Oracle. An URL (eg "//oracle.foo.com" or "//". Try both with and without "//")
          1521 = port no.
          yourDB = Oralce database name.


          6. Edit the the first lines in the file "jboss/server/default/conf/standardjaws.xml":


          Object to SQL mapping for Oralce 8 and 9i are the same.

          7. Make sure your Oracle-DB is running.

          8. Deploy an entity bean in JBoss.

          9. Start a client....

          10. I hope I did not forget anything. =.O)

          • 2. Re: Definitive guide to seting up oracle datasource?
            Thomas Diesler Master

            ... thanks, you are a hero.

            When I start JBoss 3.0.2 I see the following info - that makes me believe JBoss knows about oracle.

            20:49:33,982 INFO [OracleDS] Bound connection factory for resource adapter 'JBoss LocalTransaction JDBC Wrapper' to JNI name 'java:/OracleDS'

            Getting a connection in my BMP Enity Bean also works, however when I try to access the DB I get a hsqldb style error message: table not found

            InitialContext ic = new InitialContext();
            DataSource ds = (DataSource) ic.lookup("java:comp/env/OracleDS");
            Connection con = ds.getConnection();
            DatabaseMetaData dbmd = con.getMetaData();
            System.err.println (con.getCatalog());
            System.err.println (dbmd.getUserName());
            System.err.println (dbmd.getURL());

            leads to

            20:57:41,924 ERROR [STDERR] null
            20:57:41,994 ERROR [STDERR] SA
            20:57:41,994 ERROR [STDERR] jdbc:hsqldb:hsql://localhost:1476

            Ok, it's still hsqldb.

            Any ideas?

            Thanks Tomsk