You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by I D B Major <im...@compsci.bristol.ac.uk> on 2006/06/23 11:00:39 UTC

Problem accessing two McKoi databases from Tomcat

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: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Problem accessing two McKoi databases from Tomcat

Posted by I D B Major <im...@compsci.bristol.ac.uk>.
Brian

many thanks problem solved - I had changed server.xml to show that the 
Resource jdbc/mydb was of type type="DataSource" not 
type="javax.sql.DataSource" ! This solved it now works and shows output 
from both databases.

Many, many thanks!

Cheers,

Iain



I D B Major wrote:
> Hi again,
>
> Having renamed both the context-params I get the following error
>
> org.apache.jasper.JasperException: Unable to get connection, 
> DataSource invalid: "java.lang.NullPointerException"
>
>
> Which sort of implies that the default name of 
> 'javax.servlet.jsp.jstl.sql.dataSource'  must be used once. However if 
> I include it for one context-param and try to access both (say I use 
> 'javax.sql.dataSource' for the other) then the error message reverts 
> to the java.sql.SQLException: No suitable driver (which is at least 
> different from where I was before I specified the dataSource attribute 
> in the <sql > tags.
>
> This leaves me still unable to access the second database.
>
> any further suggestions will be very welcome!
>
> Iain
>
>
>
>
> I D B Major wrote:
>> Hi Brian,
>>
>> many thanks for the suggestions, I'm sure I'm now close, but I'm not 
>> quite out of the trees yet. I have looked up the spec and followed 
>> your suggestion to specify the datasource and I have changed one of 
>> the context-params to simply dataSource. This means I now no longer 
>> get the same error message but instead I get an error message at the 
>> point where I call ShowTest (which is the context-param I changed) 
>> which has the root cause;
>>
>> javax.servlet.ServletException: Unable to get connection, DataSource 
>> invalid: "java.sql.SQLException: No suitable driver"
>>
>> I'm not sure why this is. If you can see it please let me know.
>>
>> Once again many thanks,
>>
>> Iain.
>>
>>
>>
>> Brian Buchanan wrote:
>>
>> 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: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>>
>>
>>
>>> -----Original Message-----
>>> From: I D B Major <im...@compsci.bristol.ac.uk>
>>> 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
>>>>>
>>>>>       
>>
>>
>
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Problem accessing two McKoi databases from Tomcat

Posted by I D B Major <im...@compsci.bristol.ac.uk>.
Hi again,

Having renamed both the context-params I get the following error

org.apache.jasper.JasperException: Unable to get connection, DataSource invalid: "java.lang.NullPointerException"


Which sort of implies that the default name of 
'javax.servlet.jsp.jstl.sql.dataSource'  must be used once. However if I 
include it for one context-param and try to access both (say I use 
'javax.sql.dataSource' for the other) then the error message reverts to 
the java.sql.SQLException: No suitable driver (which is at least 
different from where I was before I specified the dataSource attribute 
in the <sql > tags.

This leaves me still unable to access the second database.

any further suggestions will be very welcome!

Iain




I D B Major wrote:
> Hi Brian,
>
> many thanks for the suggestions, I'm sure I'm now close, but I'm not 
> quite out of the trees yet. I have looked up the spec and followed 
> your suggestion to specify the datasource and I have changed one of 
> the context-params to simply dataSource. This means I now no longer 
> get the same error message but instead I get an error message at the 
> point where I call ShowTest (which is the context-param I changed) 
> which has the root cause;
>
> javax.servlet.ServletException: Unable to get connection, DataSource 
> invalid: "java.sql.SQLException: No suitable driver"
>
> I'm not sure why this is. If you can see it please let me know.
>
> Once again many thanks,
>
> Iain.
>
>
>
> Brian Buchanan wrote:
>
> 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: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>
>
>> -----Original Message-----
>> From: I D B Major <im...@compsci.bristol.ac.uk>
>> 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
>>>>
>>>>       
>
>


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Problem accessing two McKoi databases from Tomcat

Posted by I D B Major <im...@compsci.bristol.ac.uk>.
Hi Brian,

many thanks for the suggestions, I'm sure I'm now close, but I'm not 
quite out of the trees yet. I have looked up the spec and followed your 
suggestion to specify the datasource and I have changed one of the 
context-params to simply dataSource. This means I now no longer get the 
same error message but instead I get an error message at the point where 
I call ShowTest (which is the context-param I changed) which has the 
root cause;

javax.servlet.ServletException: Unable to get connection, DataSource invalid: "java.sql.SQLException: No suitable driver"

I'm not sure why this is. If you can see it please let me know.

Once again many thanks,

Iain.



Brian Buchanan wrote:

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: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org



> -----Original Message-----
> From: I D B Major <im...@compsci.bristol.ac.uk>
> 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
>>>
>>>       


Re: Problem accessing two McKoi databases from Tomcat

Posted by Brian Buchanan <Br...@interfast.ca>.

-----Original Message-----
From: I D B Major <im...@compsci.bristol.ac.uk>
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: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Problem accessing two McKoi databases from Tomcat

Posted by I D B Major <im...@compsci.bristol.ac.uk>.
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"
   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
   <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
   <%@ taglib prefix="a" tagdir="/WEB-INF/tags" %>
 
    <html>
    <head>
        <Title>Film Database</Title>
        <h1>Film Database - Update page</h1>
    </head>
   
    <body>
        ...
        <a:ShowFilms />
        <a:ShowTest />
        ...
   </body>
    </html>

Where ShowFilms.tag is

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="sql" uri="http://java.sun.com/jsp/jstl/sql" %>
  <sql:query var="film">
     select * from Film
  </sql:query>
  <table border="3">
    <tr>
        <th>FilmID</th>
        <th>Title</th>
        ...
    </tr>
  <c:forEach var="a" items="${film.rows}">  
    <tr>
        <td>${a.filmID}</td>
        <td>${a.title}</td>
        ...
    </tr>
     </c:forEach>
    </table>


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,

Iain




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" 
> <im...@compsci.bristol.ac.uk>
> To: "Tomcat Users List" <us...@tomcat.apache.org>
> 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: users@tomcat.apache.org
>>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>>> For additional commands, e-mail: users-help@tomcat.apache.org
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To start a new topic, e-mail: users@tomcat.apache.org
>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>


Re: Problem accessing two McKoi databases from Tomcat

Posted by Martin Gainty <mg...@hotmail.com>.
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" <im...@compsci.bristol.ac.uk>
To: "Tomcat Users List" <us...@tomcat.apache.org>
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: users@tomcat.apache.org
>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>>
>
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
> 

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Problem accessing two McKoi databases from Tomcat

Posted by I D B Major <im...@compsci.bristol.ac.uk>.
Can anyone help further?

I've now skimmed the Java Servlet spec in all the areas I could think to 
be relevant but without success. Can anyone give me an example of where 
two different resources of the same type might be referenced for access? 
Maybe if I could see how two other resources (not McKoi databases like 
I'm using) are referenced then I could use that to set up my own 
reference to the McKoi databases?

Thinking laterally is there any mileage in trying to find out how to 
override the default value for <param-name> ??

Thanks especially to Tejas and Martin for their suggestions,

Iain



Tejas Bavishi wrote:
> Hi
>
> Not sure if this is helpful to you. I had found this URL useful. The URL
> shows how to setup a JNDI DataSource in Tomcat.
> http://tomcat.apache.org/tomcat-4.1-doc/jndi-datasource-examples-howto.html
>
> Also, check the Java Servlet specification for more information.
>
> Regards
> Tejas
>
>
> -----Original Message-----
> From: I D B Major [mailto:im5033@cs.bris.ac.uk]
> Sent: Monday, June 26, 2006 2:15 PM
> To: Tomcat Users List
> 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: users@tomcat.apache.org
>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>>
>>     
>
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>
> http://www.patni.com
> World-Wide Partnerships. World-Class Solutions.
> _____________________________________________________________________
>
> This e-mail message may contain proprietary, confidential or legally
> privileged information for the sole use of the person or entity to
> whom this message was originally addressed. Any review, e-transmission
> dissemination or other use of or taking of any action in reliance upon
> this information by persons or entities other than the intended
> recipient is prohibited. If you have received this e-mail in error
> kindly delete  this e-mail from your records. If it appears that this
> mail has been forwarded to you without proper authority, please notify
> us immediately at netadmin@patni.com and delete this mail. 
> _____________________________________________________________________
>
>   
> ------------------------------------------------------------------------
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Problem accessing two McKoi databases from Tomcat

Posted by I D B Major <im...@compsci.bristol.ac.uk>.
Hi Tejas,

thanks for the suggestions. Had already read over

http://tomcat.apache.org/tomcat-4.1-doc/jndi-datasource-examples-howto.html

without finding the answers but have re-read in case. No luck. Will go 
over the Java Servlet spec again soon.

Iain



Tejas Bavishi wrote:
> Hi
>
> Not sure if this is helpful to you. I had found this URL useful. The URL
> shows how to setup a JNDI DataSource in Tomcat.
> http://tomcat.apache.org/tomcat-4.1-doc/jndi-datasource-examples-howto.html
>
> Also, check the Java Servlet specification for more information.
>
> Regards
> Tejas
>
>
> -----Original Message-----
> From: I D B Major [mailto:im5033@cs.bris.ac.uk]
> Sent: Monday, June 26, 2006 2:15 PM
> To: Tomcat Users List
> 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: users@tomcat.apache.org
>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>>
>>     
>
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>
> http://www.patni.com
> World-Wide Partnerships. World-Class Solutions.
> _____________________________________________________________________
>
> This e-mail message may contain proprietary, confidential or legally
> privileged information for the sole use of the person or entity to
> whom this message was originally addressed. Any review, e-transmission
> dissemination or other use of or taking of any action in reliance upon
> this information by persons or entities other than the intended
> recipient is prohibited. If you have received this e-mail in error
> kindly delete  this e-mail from your records. If it appears that this
> mail has been forwarded to you without proper authority, please notify
> us immediately at netadmin@patni.com and delete this mail. 
> _____________________________________________________________________
>
>   
> ------------------------------------------------------------------------
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: Problem accessing two McKoi databases from Tomcat

Posted by Tejas Bavishi <te...@patni.com>.
Hi

Not sure if this is helpful to you. I had found this URL useful. The URL
shows how to setup a JNDI DataSource in Tomcat.
http://tomcat.apache.org/tomcat-4.1-doc/jndi-datasource-examples-howto.html

Also, check the Java Servlet specification for more information.

Regards
Tejas


-----Original Message-----
From: I D B Major [mailto:im5033@cs.bris.ac.uk]
Sent: Monday, June 26, 2006 2:15 PM
To: Tomcat Users List
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: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


http://www.patni.com
World-Wide Partnerships. World-Class Solutions.
_____________________________________________________________________

This e-mail message may contain proprietary, confidential or legally
privileged information for the sole use of the person or entity to
whom this message was originally addressed. Any review, e-transmission
dissemination or other use of or taking of any action in reliance upon
this information by persons or entities other than the intended
recipient is prohibited. If you have received this e-mail in error
kindly delete  this e-mail from your records. If it appears that this
mail has been forwarded to you without proper authority, please notify
us immediately at netadmin@patni.com and delete this mail. 
_____________________________________________________________________


Re: Problem accessing two McKoi databases from Tomcat

Posted by I D B Major <im...@compsci.bristol.ac.uk>.
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: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org