What happens when you attempt to refrence the JSP from a browser ?  The
connection pool with Oracle is not established until a JSP which uses the
pool is requested.

as

-----Original Message-----
From: Manavendra Gupta [mailto:[EMAIL PROTECTED]]
Sent: Monday, November 18, 2002 8:30 AM
To: Tomcat Users List
Subject: Oracle thin client DataSource configuration with tomcat


Hi,

I'm sure the gurus have discussed this issue a number of times and probably
found a solution too, but after reading all the documents i found, i came to
a naught.

Its the same problem: server.xml and web.xml seem to have been configured
properly, yet when i try to obtain a datasource i get nothing.

Here's the scenario:
setup: tomcat 4.0.3 LE, jdk1.4, RHL 7.3

server.xml
  <!-- RTI Billing Context -->
        <Context path="/rti" docBase="rti" debug="0"
                         reloadable="true" crossContext="true">
                  <Logger className="org.apache.catalina.logger.FileLogger"
                             prefix="rti_log." suffix=".txt"
                  timestamp="true"/>
                <Resource name="jdbc/RtiDB" auth="Container"
                            type="javax.sql.DataSource"/>
                  <ResourceParams name="jdbc/RtiDB">
                    <parameter>
                        <name>user</name>
                        <value>rti</value>
                    </parameter>
                    <parameter>
                        <name>password</name>
                        <value>rti</value>
                    </parameter>
                    <parameter>
                        <name>driverClassName</name>
                        <value>oracle.driver.OracleDriver</value>
                     </parameter>
                     <parameter>
                         <name>URL</name>

<value>jdbc:odbc:thin:@rti:1521:rti?user=rti;password=rti</value>
                     </parameter>
                      <parameter>
                         <name>maxActive</name>
                         <value>20</value>
                       </parameter>
                       <parameter>
                         <name>maxIdle</name>
                         <value>10</value>
                       </parameter>
                       <parameter>
                         <name>maxWait</name>
                         <value>-1</value>
                       </parameter>
                  </ResourceParams>
        </Context>

web.xml
<!-- Resource references -->
    <resource-ref>
        <description>DB Connection</description>
        <res-ref-name>jdbc/RtiDB</res-ref-name>
        <res-type>javax.sql.DataSource</res-type>
        <res-auth>Container</res-auth>
    </resource-ref>

DBTest.jsp
<%
  String foo = "Not Connected";
  String bar = "";

  javax.naming.Context ctx = new javax.naming.InitialContext();
  javax.naming.Context envCtx = (javax.naming.Context)
ctx.lookup("java:comp/env");
  if(ctx == null )
          throw new Exception("Boom - No Context");

  javax.sql.DataSource ds =
            (javax.sql.DataSource)envCtx.lookup("jdbc/RtiDB");

      if (ds != null) {
        java.sql.Connection conn = ds.getConnection();
        out.println("got a connection");
      }
        out.println("no luck yet");
%>

And I never get the message "got a connection". Any clues?

Btw, I have not touched the "Realm" - I don't understand what that is meant
for. Not yet.

TIA,
Manav.


--
To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to