Gerardo- http://tomcat.apache.org/tomcat-6.0-doc/printer/jndi-datasource-examples-howto.html
server.xml need to identify all of the attributes of the DataSource as in <Context path="/DBTest" docBase="DBTest" debug="5" reloadable="true" crossContext="true"> .... <Resource name="jdbc/TestDB" auth="Container" type="javax.sql.DataSource" maxActive="100" maxIdle="30" maxWait="10000" username="javauser" password="javadude" driverClassName="com.mysql.jdbc.Driver" url="jdbc:mysql://localhost:3306/javatest?autoReconnect=true"/> ... </Context> web.xml needs to identify resource-ref name of jdbc/TestDB as DataSource <web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" version="2.4"> <description>MySQL Test App</description> <resource-ref> <description>DB Connection</description> <res-ref-name>jdbc/TestDB</res-ref-name> <res-type>javax.sql.DataSource</res-type> <res-auth>Container</res-auth> </resource-ref> </web-app> Test the access capability for DataSource logic <%@ taglib uri="http://java.sun.com/jsp/jstl/sql" prefix="sql" %> <sql:query var="rs" dataSource="jdbc/TestDB"> select id, foo, bar from testdata </sql:query> ... Does this help? Saludos, M- This e-mail communication and any attachments may contain confidential and privileged information for the use of the designated recipients named above. If you are not the intended recipient, you are hereby notified that you have received this communication in error and that any review, disclosure, dissemination, distribution or copying of it or its contents ----- Original Message ----- From: "Macari McCorry, Gerardo" <[EMAIL PROTECTED]> To: <users@tomcat.apache.org> Sent: Tuesday, November 28, 2006 6:32 AM Subject: javax.naming.NameNotFoundException: Name pool is not bound in this Context Hi all, Problem: Trying to asociate a database pool to a local context Error: "javax.naming.NameNotFoundException: Name pool is not bound in this Context'" Version Tomcat: 5.5.20 JDK: 5.0 OS: Windows 2000 Comment: I been using tomcat since version 3 and never has such problems (admin app works only sometimes in 5.X etc) and this is the first time I´ve ever posted a question. Usually I found the answers from the docs or the web. Thinking of moving to Jetty after this. server.xml (just the host part) <Host appBase="webapps" name="localhost"> <context path="/elibrary" docBase="elibrary" reloadable="false" crossContext="false" cookies="true" unpackWAR="true"> <Resource name="pool" type="javax.sql.DataSource" password="XXXXXX" driverClassName="oracle.jdbc.driver.OracleDriver" maxIdle="2" maxWait="5000" validationQuery="select 1 from TFEW_PARAMETRO" username="FEWI_APP" url="jdbc:oracle:thin:@172.22.144.45:1533:FEWP92" maxActive="4"/> <!-- <ResourceLink global="pool" name="pool" type="javax.sql.DataSource"/> --> </context> </Host> JSP Test from my context elibrary (no imports, try/catch for clarity) Test.jsp Context initContext = new InitialContext(); Context envContext = (Context)initContext.lookup("java:/comp/env"); DataSource ds = (DataSource)envContext.lookup("pool"); Connection conn = ds.getConnection(); Error: "javax.naming.NameNotFoundException: Name pool is not bound in this Context'" Thanks, Gerardo ------------------------------------------------------------------------------------------------------------------- Este correo electrónico y, en su caso, cualquier fichero anexo al mismo, contiene información de carácter confidencial exclusivamente dirigida a su destinatario o destinatarios. Queda prohibida su divulgación, copia o distribución a terceros sin la previa autorización escrita de Indra. En el caso de haber recibido este correo electrónico por error, se ruega notificar inmediatamente esta circunstancia mediante reenvío a la dirección electrónica del remitente. POR FAVOR, ANTES DE IMPRIMIR ESTE CORREO ELECTRÓNICO CONSIDERE SU APORTACIÓN A LA CONSERVACIÓN DEL MEDIO AMBIENTE POR LA REDUCCIÓN DE CONSUMO DE PAPEL. The information in this e-mail and in any attachments is confidential and solely for the attention and use of the named addressee(s). You are hereby notified that any dissemination, distribution or copy of this communication is prohibited without the prior written consent of Indra. If you have received this communication in error, please, notify the sender by reply e-mail. PLEASE CONSIDER YOUR ENVIRONMENTAL RESPONSIBILITY BEFORE PRINTING THIS E-MAIL.