1 Reply Latest reply on Apr 25, 2006 2:42 AM by Weston M. Price

    Help me, how to connect oracle data base using oracle thin d

    veerreddy kovvuri Newbie

      I tried to connect to oracle using oracle thin driver but i got the following exception NestedSQLException.

      The implementation steps

      The oracle-ds.xml contains the following information

      <local-tx-datasource>
      <jndi-name>OracleDS</jndi-name>
      <connection-url>jdbc:oracle:thin:@192.168.72.2:1521:CM23</connection-url>
      <driver-class>oracle.jdbc.driver.OracleDriver</driver-class>
      <user-name>mdr1</user-name>
      mdr1
      <exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.OracleExceptionSorter</exception-sorter-class-name>
      <new-connection-sql>select * from tab</new-connection-sql>
      <check-valid-connection-sql>select * from tab</check-valid-connection-sql>
      </local-tx-datasource>

      I placed the oracle-ds.xml in the deploy folder.

      I wrote the code in the jsp code as follow

      try {
      InitialContext ctxt = new InitialContext();
      DataSource ds = (DataSource) ctxt.lookup("java:OracleDS");
      Connection con = ds.getConnection();
      System.out.println(con);
      }catch(Exception e){e.printStackTrace();}

      My jboss version is 3.5.2
      The exception details

      1:54:11,916 INFO [STDOUT] org.jboss.util.NestedSQLException: Could not create connection; - nested throwable: (java.lang.ArrayIndexOutOfBoundsException); - nested throwable: (org.jboss.resource.J
      ResourceException: Could not create connection; - nested throwable: (java.lang.ArrayIndexOutOfBoundsException))
      1:54:11,916 INFO [STDOUT] at org.jboss.resource.adapter.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:106)
      1:54:11,916 INFO [STDOUT] at org.apache.jsp.jdbcTest_jsp._jspService(jdbcTest_jsp.java:53)
      1:54:11,932 INFO [STDOUT] at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
      1:54:11,932 INFO [STDOUT] at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
      1:54:11,932 INFO [STDOUT] at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
      1:54:11,932 INFO [STDOUT] at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
      1:54:11,932 INFO [STDOUT] at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
      1:54:11,932 INFO [STDOUT] at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
      1:54:11,932 INFO [STDOUT] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:237)
      1:54:11,932 INFO [STDOUT] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
      1:54:11,932 INFO [STDOUT] at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)
      1:54:11,932 INFO [STDOUT] at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
      1:54:11,932 INFO [STDOUT] at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
      1:54:11,932 INFO [STDOUT] at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:198)
      1:54:11,932 INFO [STDOUT] at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:152)
      1:54:11,932 INFO [STDOUT] at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
      1:54:11,932 INFO [STDOUT] at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:72)
      1:54:11,932 INFO [STDOUT] at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
      1:54:11,932 INFO [STDOUT] at org.jboss.web.tomcat.security.JBossSecurityMgrRealm.invoke(JBossSecurityMgrRealm.java:275)
      1:54:11,932 INFO [STDOUT] at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
      1:54:11,932 INFO [STDOUT] at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
      1:54:11,932 INFO [STDOUT] at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137)
      1:54:11,932 INFO [STDOUT] at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
      1:54:11,932 INFO [STDOUT] at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
      1:54:11,932 INFO [STDOUT] at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
      1:54:11,932 INFO [STDOUT] at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
      1:54:11,932 INFO [STDOUT] at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
      1:54:11,932 INFO [STDOUT] at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
      1:54:11,932 INFO [STDOUT] at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
      1:54:11,932 INFO [STDOUT] at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929)
      1:54:11,932 INFO [STDOUT] at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)
      1:54:11,932 INFO [STDOUT] at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799)
      1:54:11,932 INFO [STDOUT] at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705)
      1:54:11,932 INFO [STDOUT] at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)
      1:54:11,932 INFO [STDOUT] at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)
      1:54:11,932 INFO [STDOUT] at java.lang.Thread.run(Thread.java:479)
      1:54:11,932 INFO [STDOUT] + nested throwable:
      1:54:11,932 INFO [STDOUT] org.jboss.resource.JBossResourceException: Could not create connection; - nested throwable: (java.lang.ArrayIndexOutOfBoundsException)
      1:54:11,932 INFO [STDOUT] at org.jboss.resource.adapter.jdbc.local.LocalManagedConnectionFactory.createManagedConnection(LocalManagedConnectionFactory.java:168)
      1:54:11,932 INFO [STDOUT] at org.jboss.resource.connectionmanager.InternalManagedConnectionPool.createConnectionEventListener(InternalManagedConnectionPool.java:504)
      1:54:11,932 INFO [STDOUT] at org.jboss.resource.connectionmanager.InternalManagedConnectionPool.getConnection(InternalManagedConnectionPool.java:214)
      1:54:11,932 INFO [STDOUT] at org.jboss.resource.connectionmanager.JBossManagedConnectionPool$BasePool.getConnection(JBossManagedConnectionPool.java:534)
      1:54:11,932 INFO [STDOUT] at org.jboss.resource.connectionmanager.BaseConnectionManager2.getManagedConnection(BaseConnectionManager2.java:444)
      1:54:11,932 INFO [STDOUT] at org.jboss.resource.connectionmanager.TxConnectionManager.getManagedConnection(TxConnectionManager.java:312)
      1:54:11,932 INFO [STDOUT] at org.jboss.resource.connectionmanager.BaseConnectionManager2.allocateConnection(BaseConnectionManager2.java:496)
      1:54:11,932 INFO [STDOUT] at org.jboss.resource.connectionmanager.BaseConnectionManager2$ConnectionManagerProxy.allocateConnection(BaseConnectionManager2.java:887)
      1:54:11,932 INFO [STDOUT] at org.jboss.resource.adapter.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:102)
      1:54:11,932 INFO [STDOUT] at org.apache.jsp.jdbcTest_jsp._jspService(jdbcTest_jsp.java:53)
      1:54:11,932 INFO [STDOUT] at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
      1:54:11,932 INFO [STDOUT] at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
      1:54:11,932 INFO [STDOUT] at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
      1:54:11,932 INFO [STDOUT] at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
      1:54:11,932 INFO [STDOUT] at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
      1:54:11,932 INFO [STDOUT] at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
      1:54:11,932 INFO [STDOUT] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:237)
      1:54:11,932 INFO [STDOUT] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
      1:54:11,932 INFO [STDOUT] at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)
      1:54:11,932 INFO [STDOUT] at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
      1:54:11,932 INFO [STDOUT] at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
      1:54:11,932 INFO [STDOUT] at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:198)
      1:54:11,932 INFO [STDOUT] at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:152)
      1:54:11,932 INFO [STDOUT] at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
      1:54:11,932 INFO [STDOUT] at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:72)
      1:54:11,932 INFO [STDOUT] at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
      1:54:11,932 INFO [STDOUT] at org.jboss.web.tomcat.security.JBossSecurityMgrRealm.invoke(JBossSecurityMgrRealm.java:275)
      1:54:11,932 INFO [STDOUT] at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
      1:54:11,932 INFO [STDOUT] at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
      1:54:11,932 INFO [STDOUT] at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137)
      1:54:11,932 INFO [STDOUT] at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
      1:54:11,932 INFO [STDOUT] at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
      1:54:11,932 INFO [STDOUT] at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
      1:54:11,932 INFO [STDOUT] at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
      1:54:11,932 INFO [STDOUT] at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
      1:54:11,932 INFO [STDOUT] at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
      1:54:11,932 INFO [STDOUT] at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
      1:54:11,932 INFO [STDOUT] at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929)
      1:54:11,932 INFO [STDOUT] at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)
      1:54:11,932 INFO [STDOUT] at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799)
      1:54:11,948 INFO [STDOUT] at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705)
      1:54:11,948 INFO [STDOUT] at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)
      1:54:11,948 INFO [STDOUT] at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)
      1:54:11,948 INFO [STDOUT] at java.lang.Thread.run(Thread.java:479)
      1:54:11,948 INFO [STDOUT] + nested throwable:
      1:54:11,948 INFO [STDOUT] java.lang.ArrayIndexOutOfBoundsException
      1:54:11,948 INFO [STDOUT] at oracle.security.o3logon.C0.r(C0)
      1:54:11,948 INFO [STDOUT] at oracle.security.o3logon.C0.l(C0)
      1:54:11,948 INFO [STDOUT] at oracle.security.o3logon.C1.c(C1)
      1:54:11,948 INFO [STDOUT] at oracle.security.o3logon.O3LoginClientHelper.getEPasswd(O3LoginClientHelper)
      1:54:11,948 INFO [STDOUT] at oracle.jdbc.ttc7.O3log.(O3log.java:289)
      1:54:11,948 INFO [STDOUT] at oracle.jdbc.ttc7.TTC7Protocol.logon(TTC7Protocol.java:251)
      1:54:11,948 INFO [STDOUT] at oracle.jdbc.driver.OracleConnection.(OracleConnection.java:249)
      1:54:11,948 INFO [STDOUT] at oracle.jdbc.driver.OracleDriver.getConnectionInstance(OracleDriver.java:365)
      1:54:11,948 INFO [STDOUT] at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:260)
      1:54:11,948 INFO [STDOUT] at org.jboss.resource.adapter.jdbc.local.LocalManagedConnectionFactory.createManagedConnection(LocalManagedConnectionFactory.java:158)
      1:54:11,948 INFO [STDOUT] at org.jboss.resource.connectionmanager.InternalManagedConnectionPool.createConnectionEventListener(InternalManagedConnectionPool.java:504)
      1:54:11,948 INFO [STDOUT] at org.jboss.resource.connectionmanager.InternalManagedConnectionPool.getConnection(InternalManagedConnectionPool.java:214)
      1:54:11,948 INFO [STDOUT] at org.jboss.resource.connectionmanager.JBossManagedConnectionPool$BasePool.getConnection(JBossManagedConnectionPool.java:534)
      1:54:11,948 INFO [STDOUT] at org.jboss.resource.connectionmanager.BaseConnectionManager2.getManagedConnection(BaseConnectionManager2.java:444)
      1:54:11,948 INFO [STDOUT] at org.jboss.resource.connectionmanager.TxConnectionManager.getManagedConnection(TxConnectionManager.java:312)
      1:54:11,948 INFO [STDOUT] at org.jboss.resource.connectionmanager.BaseConnectionManager2.allocateConnection(BaseConnectionManager2.java:496)
      1:54:11,948 INFO [STDOUT] at org.jboss.resource.connectionmanager.BaseConnectionManager2$ConnectionManagerProxy.allocateConnection(BaseConnectionManager2.java:887)
      1:54:11,948 INFO [STDOUT] at org.jboss.resource.adapter.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:102)
      1:54:11,948 INFO [STDOUT] at org.apache.jsp.jdbcTest_jsp._jspService(jdbcTest_jsp.java:53)
      1:54:11,948 INFO [STDOUT] at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
      1:54:11,948 INFO [STDOUT] at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
      1:54:11,948 INFO [STDOUT] at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
      1:54:11,948 INFO [STDOUT] at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
      1:54:11,948 INFO [STDOUT] at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
      1:54:11,948 INFO [STDOUT] at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
      1:54:11,948 INFO [STDOUT] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:237)
      1:54:11,948 INFO [STDOUT] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
      1:54:11,948 INFO [STDOUT] at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)
      1:54:11,948 INFO [STDOUT] at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
      1:54:11,948 INFO [STDOUT] at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
      1:54:11,948 INFO [STDOUT] at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:198)
      1:54:11,948 INFO [STDOUT] at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:152)
      1:54:11,948 INFO [STDOUT] at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
      1:54:11,948 INFO [STDOUT] at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:72)
      1:54:11,948 INFO [STDOUT] at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
      1:54:11,948 INFO [STDOUT] at org.jboss.web.tomcat.security.JBossSecurityMgrRealm.invoke(JBossSecurityMgrRealm.java:275)
      1:54:11,948 INFO [STDOUT] at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
      1:54:11,948 INFO [STDOUT] at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
      1:54:11,948 INFO [STDOUT] at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137)
      1:54:11,948 INFO [STDOUT] at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
      1:54:11,948 INFO [STDOUT] at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
      1:54:11,948 INFO [STDOUT] at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
      1:54:11,948 INFO [STDOUT] at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
      1:54:11,948 INFO [STDOUT] at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
      1:54:11,948 INFO [STDOUT] at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
      1:54:11,948 INFO [STDOUT] at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
      1:54:11,948 INFO [STDOUT] at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929)
      1:54:11,948 INFO [STDOUT] at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)
      1:54:11,948 INFO [STDOUT] at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799)
      1:54:11,948 INFO [STDOUT] at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705)
      1:54:11,948 INFO [STDOUT] at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)
      1:54:11,948 INFO [STDOUT] at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)
      1:54:11,948 INFO [STDOUT] at java.lang.Thread.run(Thread.java:479)













        • 1. Re: Help me, how to connect oracle data base using oracle th
          Weston M. Price Master

          First off, for future reference, you originally posted this message to the Development forums, don't do that. The first post of that forum explicitly states NOT to post user questions there.

          Second, it appears that your XML is invalid, and judging by your stacktrace, I would assume that Oracle is throwing the error because you have not set a password.

          <user-name>mdr1</user-name>
          mdr1

          This is most likely causing the problem. Change this to

          <user-name>mdr1</user-name>
          mdr1