0 Replies Latest reply on Aug 22, 2002 9:26 AM by Radim Krcmar

    Connect to Oracle

    Radim Krcmar Newbie

      Hi everybody,

      in first time I am sorry but I am not good in English and I use JBoss in first time.

      I have this structure:
      testDB.ear
      META-INF
      application.xml
      testDB.war
      testDB.jsp

      In testDB file I test database connection.
      I use only
      ************************************
      String jdbcClass = "oracle.jdbc.driver.OracleDriver";

      Class.forName(jdbcClass).newInstance();
      Connection conn = DriverManager.getConnection(jdbcURL,user,password);
      DatabaseMetaData dma = conn.getMetaData();
      ************************************

      And about database. I copy oracle-service.xml ino Deploy directory and change:
      ************************************
      <config-property name="ConnectionURL" type="java.lang.String">myConnection</config-property>
      <config-property name="DriverClass" type="java.lang.String">oracle.jdbc.driver.OracleDriver</config-property>
      <config-property name="UserName" type="java.lang.String">MyName</config-property>
      <config-property name="Password" type="java.lang.String">myPassword</config-property>

      Then I add into login-config.xml file
      *************************************
      <application-policy name="OracleDbRealm">

      <login-module code="org.jboss.resource.security.ConfiguredIdentityLoginModule" flag="required">
      <module-option name="principal">MyPrincipal</module-option>
      <module-option name="userName">MyName</module-option>
      <module-option name="password">MyPassword</module-option>
      <module-option name="managedConnectionFactoryName">jboss.jca:service=LocalTxCM,name=OracleDS</module-option>
      </login-module>

      </application-policy>
      ************************************

      And last what I did was that I copy classes12.zip into %JBOSS_HOME%\lib directory.

      When I run JBoss everything is OK, but when I run my script, then Exception arrived (something about "oracle.jdbc.driver.OracleDriver").

      Please help me. I do not know what I must do when I can use database in my applications? What is bad?

      Thank you very much.
      Radim