tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From I D B Major <>
Subject Re: Problem accessing two McKoi databases from Tomcat
Date Mon, 26 Jun 2006 12:18:59 GMT
Hi Martin,

/"So if I understand ..Your 2 separate jdbc connections are acquiring 
Data .. " /

That's what I'm aiming at. The idea (just to begin with) is to print out 
the contents of two very small test tables from different databases. I'm 
able to use each separately but once I try to use both I get nothing 
from either. Seemingly the only name I can use for param-name is 
javax.servlet.jsp.jstl.sql.dataSource which I have read somewhere is a 
default but you can't duplicate it. Therefore I can't access two at 
once. Maybe I need to put the references to the two databases elsewhere 
than in WEB-INF/web.xml but I can't see where.

As for merging data etc I'm using my own JSTL tag files in a JSP page to 
print out on the page - see edited details below;

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
   <%@ taglib prefix="c" uri="" %>
   <%@ taglib prefix="a" tagdir="/WEB-INF/tags" %>
        <Title>Film Database</Title>
        <h1>Film Database - Update page</h1>
        <a:ShowFilms />
        <a:ShowTest />

Where ShowFilms.tag is

<%@ taglib prefix="c" uri="" %>
<%@ taglib prefix="sql" uri="" %>
  <sql:query var="film">
     select * from Film
  <table border="3">
  <c:forEach var="a" items="${film.rows}">  

As I said above each tag works in isolation if I alter the name of the 
relevant <context><param-name> thus my tag files are all correct.

Many thanks for your help,


Martin Gainty wrote:
> So if I understand ..Your 2 separate jdbc connections are acquiring 
> Data ..
> but then once both resultsets are acquired I would suggest you must 
> programatically merging the contents
> before sending the (presumably HTML) formatted info back via the 
> Response stream
> Do you have any requirements on how this data should be formatted?
> e.g.
> Resultset from DB1 followed by Resultset from DB2
> -OR-
> one line of Data from DB1 interleaved by 1 line from DB2
> Anyone else ???
> Martin--
> This email message and any files transmitted with it contain confidential
> information intended only for the person(s) to whom this email message is
> addressed.  If you have received this email message in error, please 
> notify
> the sender immediately by telephone or email and destroy the original
> message without making a copy.  Thank you.
> ----- Original Message ----- From: "I D B Major" 
> <>
> To: "Tomcat Users List" <>
> Sent: Monday, June 26, 2006 4:44 AM
> Subject: Re: Problem accessing two McKoi databases from Tomcat
>> 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
>>> ---------------------------------------------------------------------
>>> To start a new topic, e-mail:
>>> To unsubscribe, e-mail:
>>> For additional commands, e-mail:
>> ---------------------------------------------------------------------
>> To start a new topic, e-mail:
>> To unsubscribe, e-mail:
>> For additional commands, e-mail:
> ---------------------------------------------------------------------
> To start a new topic, e-mail:
> To unsubscribe, e-mail:
> For additional commands, e-mail:

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message