-----Original Message----- From: I D B Major <[EMAIL PROTECTED]> Date: Mon, 26 Jun 2006 09:44:37 +0100
> Hi all, > > please can someone confirm whether I need to clarify anything in my > question or take a different approach since I have had no replies and > am > anxious to make sure I am doing all I can to seek help in the correct > way. Please correct me if my approach is wrong! > > many thanks > > > Iain > > > I D B Major wrote: > > Hi > > > > I am a student trying to set up a project using JSP with JSTL custom > > tags to provide dynamic pages to allow a web-based ticketing system > > for independent cinemas. I am at the early stages of testing that I > > can use the technologies. I have installed and configured Tomcat to > > allow password protection to the site and I have embedded a McKoi > > database which I can access and use to do insert, update and delete > > queries using a test JSP page which has customised JSTL tags that are > > used to run the SQL query on the database. > > > > I am now trying to display data from two separate databases. I can > get > > each to display separately but not both at once. My issues seem to be > > around the details held in web.xml which are as follows; > > > > <context-param> > > <param-name>javax.servlet.jsp.jstl.sql.dataSource</param-name> > > <param-value>jdbc/mydb</param-value> > > </context-param> > > <resource-ref> > > <description>DB Connection</description> > > <res-ref-name>jdbc/mydb</res-ref-name> > > <res-type>javax.sql.DataSource</res-type> > > <res-auth>Container</res-auth> > > </resource-ref> > > <context-param> > > <param-name>javax.servlet.jsp.jstl.sql.dataSource</param-name> > > <param-value>jdbc/curzon</param-value> > > </context-param> > > <resource-ref> > > <description>DB Connection</description> > > <res-ref-name>jdbc/curzon</res-ref-name> > > <res-type>javax.sql.DataSource</res-type> > > <res-auth>Container</res-auth> > > </resource-ref> > > > > If I change the name of either of the <param-name> then the other > will > > work and allow database access to that database (ie <Resource> > details > > in server.xml are correctly recorded) but the one which is altered is > > not available so that Tomcat displays an error message to say the > > table requested is not found; > > > > org.apache.jasper.JasperException: javax.servlet.jsp.JspException: > > select * from Film > > > > : Table 'APP.Film' was not found. > > > > I have googled and googled, read the apache website in all areas I > can > > think of to look up and have asked my tutor for help. All without > > success. I have discovered that the <param-name> given above is a > > default so I tried adjusting the names (setting first one and then > the > > other to javax.servlet.jsp.jstl.dataSource.other or > > javax.servlet.jsp.jstl..otherdataSource or other.dataSource) and even > > removing the <context-param> altogether but none of these work. > > > > Please can someone point me in the right direction for how to find > out > > what the <param-name> needs to be set to in order to allow two > > databases to be accessed at once? > > > > many thanks, > > > > Iain M > > As I understand your problem, you have two JDBC Datasources setup, jdbc/mydb and jdbc/curzon, and you are using JSTL which means to me that your JSP pages have <sql:...> tags in them. I think you are just missing the fact that the <sql:> tags *default* to the JDBC connection as specified by the context param javax.servlet.jsp.jstl.sql.dataSource. That's only the DEFAULT value. You can override the JDBC source in the tag: You need the JSTL specification from here: http://java.sun.com/products/jsp/jstl/index.jsp and checkout page 121. In short: specify dataSource attribute to override the default. Finally, you should only define the value for the context-param 'javax.servlet.jsp.jstl.sql.dataSource' once in your web.xml. It's only setting the default for the context so having the second is only overriding the first. (or the otherway around) sample.jsp (untested) ---------- <%@ page language='java'%> <%@ taglib prefix='sql' uri='http://java.sun.com/jsp/jstl/sql' %> <%@ taglib prefix='c' uri='http://java.sun.com/jsp/jstl/core' %> <sql:query var='testmydb' dataSource='jdbc/mydb'> select * from Film </sql:query> <sql:query var='testcurzon' dataSource='jdbc/curzon'> select * from Film </sql:query> ... etc. I HTH. ._. Brian --------------------------------------------------------------------- To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]