Hello, I try to access to my Oracle database thanks to the new services of Tomcat4.0. I read all the interesting documentation on the Jakarta-Tomcat web site :
http://jakarta.apache.org/tomcat/tomcat-4.0-doc/jndi-resources-howto.html "Tomcat 4 provides a JNDI InitialContext implementation instance to web applications running under it, in a manner that is compatible with those provided by a Java2 Enterprise Edition application server. Entries in this InitialContext are configured in the $CATALINA_HOME/conf/server.xml file, and may be referenced by the following elements in the web application deployment descriptor (/WEB-INF/web.xml) of your web application:" and I tried the following : server.xml (located in /usr/local/jakarta-tomcat-4.0.2/conf): ------------------------------------------------------------- <Context path="/Test" docBase="/home/fmo/myWebProject/" debug="4" reloadable="true" crossContext="true"> <Logger className="org.apache.catalina.logger.FileLogger" prefix="localhost_test." suffix=".txt" timestamp="true"/> <Resource name="jdbc/SIR_DB" auth="Container" type="javax.sql.DataSource"/> <ResourceParams name="jdbc/SIR_DB"> <parameter> <name>user</name> <value>fred</value> </parameter> <parameter> <name>password</name> <value>fred</value> </parameter> <parameter> <name>driverClassName</name> <value>oracle.jdbc.driver.OracleDriver</value> </parameter> <parameter> <name>driverName</name> <value>jdbc:oracle:thin:@ukki:1521:develdb</value> </parameter> </ResourceParams> </Context> my web.xml (located in /home/fred/myproject/WEB-INF/): ------------------------------------------------------ <resource-ref> <description>Resource reference to a factory for java.sql.Connection</description> <res-ref-name>jdbc/SIR_DB</res-ref-name> <res-type>javax.sql.DataSource</res-type> <res-auth>Container</res-auth> </resource-ref> my jsp file (located in /home/fred/myproject/): ----------------------------------------------- ... <% javax.naming.Context initCtx = null; javax.naming.Context envCtx = null; // Obtain our environment naming context initCtx = new javax.naming.InitialContext(); envCtx = (javax.naming.Context) initCtx.lookup("java:comp/env"); // Look up our data source ds = (oracle.jdbc.pool.OracleDataSource) envCtx.lookup("jdbc/SIR_DB"); ... %> Where "ds" is always null. So, do we have to create an initialContext, or to had a subcontext or to install an LDAP directory to manage these resources ? Does anyone could help me ? Thanks in advance, Fred. -- To unsubscribe: <mailto:[EMAIL PROTECTED]> For additional commands: <mailto:[EMAIL PROTECTED]> Troubles with the list: <mailto:[EMAIL PROTECTED]>
