Its seems you have correctly defined the datasource, but it is not linked to your application. In the server.xml your application should be defined as a "context" and in the context you have to specify that the global resource defined earlier is available to this application.
Look at resource-ref settings. You can also defined the resource directly within your context, then the reference is not necessary, but other apps cannot access the resource. Your application could also be defined in its own seperate xml file, but you still need to add the reference to the global datasource there. Charl --- werner <[EMAIL PROTECTED]> wrote: > Hi, > > I followed the example on : > http://jakarta.apache.org/tomcat/ > tomcat-5.0-doc/jndi-datasource-examples-howto.html > > The only thing I changed was jdbc/TestDB into > jdbc/weblog. > on al locations I could find. > > If I look at my page > (http://www.karnhuis.nl/gastenboek.jsp) > > The ${row.name} and other such thingies do not seem > to be 'rendered'. > > I use tomcat 5.0.19 and java version 1.4.2_04 > > I can't find anything that I did wrong so maybe one > of you will have any > idea of what went wrong. > > > I get an exception saying that jdbc is not bound to > this context. > > > > snippets : > > gastenboek.jsp > > <%@ taglib uri="http://java.sun.com/jsp/jstl/sql" > prefix="sql" %> > <%@ taglib uri="http://java.sun.com/jsp/jstl/core" > prefix="c" %> > > <sql:query var="rs" dataSource="jdbc/weblog"> > select name, datum, tekst, id from gb order by id > desc limit 10 > </sql:query> > > <c:forEach var="row" items="${rs.rows}"> > <div id='entry'> > <h4 class='title'> ${row.name} wrote on > </h4> > <h5 class='date'> ${row.datum} </h5> > ${row.tekst} > </div> > </c:forEach> > > web.xml > > <resource-ref> > <description>DB Connection</description> > <res-ref-name>jdbc/weblog</res-ref-name> > <res-type>javax.sql.DataSource</res-type> > <res-auth>Container</res-auth> > </resource-ref> > > server.xml > > <Host name="www.karnhuis.nl" appBase="xxx" > unpackWARs="true" autoDeploy="true"> > <Context path="" docBase="." > > <Logger > className="org.apache.catalina.logger.FileLogger" > directory="logs" > prefix="karnhuis_log." > suffix=".txt" > timestamp="true"/> > > <Resource name="jdbc/weblog" > auth="Container" > type="javax.sql.DataSource"/> > > <ResourceParams name="jdbc/weblog"> > <parameter> > <name>factory</name> > > <value>org.apache.commons.dbcp.BasicDataSourceFactory</value> > </parameter> > <parameter> > <name>maxActive</name> > <value>20</value> > </parameter> > <parameter> > <name>maxIdle</name> > <value>10</value> > </parameter> > <parameter> > <name>removeAbandoned</name> > <value>true</value> > </parameter> > <parameter> > > <name>removeAbandonedTimeout</name> > <value>60</value> > </parameter> > <parameter> > <name>maxWait</name> > <value>10000</value> > </parameter> > <parameter> > <name>username</name> > <value>This is a secret</value> > </parameter> > <parameter> > <name>password</name> > <value>you don't wanna > know</value> > </parameter> > <parameter> > <name>driverClassName</name> > > <value>org.gjt.mm.mysql.Driver</value> > </parameter> > <parameter> > <parameter> > <name>url</name> > > <value>jdbc:mysql://www.karnhuis.nl:3306/weblog</ > value> > </parameter> > </ResourceParams> > </Context> > </Host> > > > Kind regards > Werner van Mook > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: > [EMAIL PROTECTED] > For additional commands, e-mail: > [EMAIL PROTECTED] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
