Hi I'm currently creating a new forum site with JDK 5.0, Tomcat 5.5, and hsqldb. One of my requirements is to use a datasource. I have created a datasource in Tomcat and tested it with a jsp I put in my jfourm application. The jsp works fine, but when I try to use the same datasource with the jforum application I get the error below. I have included the database lines from my systemGlobals.properties and the datasource setting from my tomcat config. For the database.datasource.name I have tried everything java:jdbc/TestDB, java:/jdbc/TestDB, /jdbc/TestDB, jdbc/TestDB, java:/TestDB, java:TestDB, /TestDB, and TestDB, none of them seem to work. If any one has experience with this set up or just JDK 5.0, tomcat 5.5 and using a datasource can you please help.
I have seen this happen in some situations. When I can't put it to work, I do two tests: a raw jsp file (like you did) and the same code in a Java file, usually a servlet. Then a compare the code that works with the code in JForum, and (maybe) change the differences.
Rafael [originally posted on jforum.net by Rafael Steil]
I worked on this a little more and was able to come up with the solution. Retrieving datasources is different for each server. When using tomcat the property database.datasource.name needed to be prepended with java:comp/env/ not just java: . So when using a datasource named jdbc/TestDB the property looks like this