On 27/09/2003 10:23 Paul Thomas wrote:
>
> With a NullPointerException I presume? Try
>
> DataSource ds =
> (DataSource)ctx.lookupLink("java:comp/env/jdbc/PersonalDb");
>
> And rememeber that the JDBC driver _must_ be in common/lib and _must
> not_ be in the classpath.
Whoops! Actually looking at source code instead relying on memory, that
should be something like
InitialContext cxt = new InitialContext();
Context ctx2 = (Context)ctx.lookup("java:comp/env");
DataSource ds = (DataSource)ctx2.lookupLink("jdbc/PersonalDb");
Which is the only way I could find which worked on Tomcat 4.1.12. I've
just retried this on 4.1.24
InitialContext cxt = new InitialContext();
DataSource ds =
(DataSource)ctx.lookup("java:comp/env/jdbc/PersonalDb");
and that works too so whatever the problem was on the older version seems
to have been fixed.
--
Paul Thomas
+------------------------------+---------------------------------------------+
| Thomas Micro Systems Limited | Software Solutions for the Smaller
Business |
| Computer Consultants |
http://www.thomas-micro-systems-ltd.co.uk |
+------------------------------+---------------------------------------------+