tomcat-taglibs-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stephen Letschin <step...@media.umbc.edu>
Subject Standard Taglib - Catching a SQL:DataSource
Date Fri, 22 Aug 2003 19:35:27 GMT
I am attempting to use a c:catch around a sql:setDataSource with a JDNI
defined dataSource to ensure connectivity with the database exists. It
appears however that the c:catch is not working in this instance.
The code looks something like:

<c:catch var="databaseError">
    <sql:setDataSource dataSource="validJNDIDataSource" />
</c:catch>

I know the sql:setDataSource works fine but in my testing when I used an
invalid dataSource (which should through a JSPException), I actually get a
ServletException and the catch does not seem to work.
I found a bug #8366 report that seems to indicate that while
sql:setDataSource throws a JSPException while dataSource is null (which it
is not in this case) but the actual initialization exception will be
thrown on a subsequent sql:update or sql:query. Is this the intended
behavior and why my code isn't working? This seems like a poor design
decision if it is since it seems to prevent using one error handling
approach for a non-contactable database and a second for just bad data
(like selecting from a table that doesn't exist). You might be able to use
some Java scriptlet to parse the actual Exception thrown and determine if
it is the database vs the data but that seems to defeat the purpose of the
c:catch tag to avoid those type scriptlets.
Anyone have any thoughts?

Stephen Letschin
stephen@media.umbc.edu



Mime
View raw message