tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Simphoukham, Southin" <>
Subject Request for help with Oracle 8i connection on Tomcat 4.0
Date Fri, 21 Sep 2001 20:06:31 GMT

I am porting a J2EE app to Tomcat 4.0.  However I keep getting a null for my
datasource retrieval.  I am not sure if Tyrex datasource would do the job.
Or do I need to create my own Oracle datasource.  I should not have too but
who knows.Any help would be appreciated.

I have the and jdbc2_0-stdext in the \lib directory.

I have the following in my server.xml for Tomcat 4.0.

				<!-- Power Context -->
				<Context path="/PowerSouthin"
docBase="PowerSouthin.war" debug="0" reloadable="true">
className="org.apache.catalina.logger.FileLogger" prefix="Power_log."
suffix=".txt" timestamp="true"/>
					<Resource name="jdbc/OracleDB"
auth="Container" type="javax.sql.DataSource"/>

I have the following in my web.xml for my application:
	<!-- Standard Action Servlet Configuration (with debugging) -->
	<!-- Standard Action Servlet Mapping -->

	<!-- Resource Ref -->

I am getting the following console output:

----> In Try
----> ctx is: javax.naming.InitialContext@6de49c
----> envCtx is: org.apache.naming.NamingContext@7f0dde
----> have the initial context
----> dataSourceName =jdbc/OracleDB
----> m_jdbcSource = null

My is:

   try {

      if (DEBUG_ON) {
            System.out.println("----> In Try");

        //InitialContext ctx = new InitialContext();
        Context ctx = new InitialContext();
        if (DEBUG_ON) {
            System.out.println("----> ctx is: "+ ctx);
        Context envCtx = (Context) ctx.lookup("java:comp/env");

        if (DEBUG_ON) {
            System.out.println("----> envCtx is: " + envCtx);

        synchronized (ctx) {
        if (DEBUG_ON) {
            System.out.println("----> have the initial context");

        String dataSourceName ="jdbc/OracleDB";
        if (DEBUG_ON) {
          System.out.println("----> dataSourceName ="+ dataSourceName);

        //m_jdbcSource = (DataSource) ctx.lookup(dataSourceName);
        m_jdbcSource = (DataSource) envCtx.lookup(dataSourceName);

        if (DEBUG_ON) {
          System.out.println("----> m_jdbcSource = "+ m_jdbcSource);

      } //synchronized
    } catch (Exception e) {
      if (DEBUG_ON) {
        System.out.println(THIS +".initializeJDBCBean() failed. Exception: "
+ e.toString());

      sErrorMessage = e.toString() +" " + THIS + ", method:
    } // catch

View raw message