Re: Datasource/jstl problem

2005-06-23 Thread Charl Gerber
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
  descriptionDB Connection/description
  res-ref-namejdbc/weblog/res-ref-name
  res-typejavax.sql.DataSource/res-type
  res-authContainer/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
  namefactory/name
   

valueorg.apache.commons.dbcp.BasicDataSourceFactory/value
  /parameter
  parameter
  namemaxActive/name
  value20/value
  /parameter
  parameter
  namemaxIdle/name
  value10/value
  /parameter
  parameter
  nameremoveAbandoned/name
  valuetrue/value
  /parameter
  parameter
 
 nameremoveAbandonedTimeout/name
  value60/value
  /parameter
  parameter
  namemaxWait/name
  value1/value
  /parameter
  parameter
  nameusername/name
  valueThis is a secret/value
  /parameter
  parameter
  namepassword/name
  valueyou don't wanna
 know/value
  /parameter
  parameter
  namedriverClassName/name
 
 valueorg.gjt.mm.mysql.Driver/value
  /parameter
  parameter
 parameter
  nameurl/name
 
 valuejdbc: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]



Datasource/jstl problem

2005-06-22 Thread werner

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
descriptionDB Connection/description
res-ref-namejdbc/weblog/res-ref-name
res-typejavax.sql.DataSource/res-type
res-authContainer/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
namefactory/name
 
valueorg.apache.commons.dbcp.BasicDataSourceFactory/value

/parameter
parameter
namemaxActive/name
value20/value
/parameter
parameter
namemaxIdle/name
value10/value
/parameter
parameter
nameremoveAbandoned/name
valuetrue/value
/parameter
parameter
nameremoveAbandonedTimeout/name
value60/value
/parameter
parameter
namemaxWait/name
value1/value
/parameter
parameter
nameusername/name
valueThis is a secret/value
/parameter
parameter
namepassword/name
valueyou don't wanna know/value
/parameter
parameter
namedriverClassName/name
valueorg.gjt.mm.mysql.Driver/value
/parameter
parameter
   parameter
nameurl/name
valuejdbc: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]