-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Jason,

Jason Ling wrote:
| When the file is invoked,
| it only returns the header row of the table (First Name, Last Name, User
| Name, Password), but does not return the expected records from the Oracle
| data table.

[snip]

| <%! DataSource ds; %>

This is dangerous; you have a DataSource member, rather than a local.
You should change this by removing the "!" so that this is a local
variable. If you don't do this, you will run into threading problems.

| <%
|   try {
|      Context initCtx = new InitialContext();
|      Context envCtx = (Context) initCtx.lookup("java:comp/env");
|      ds = (DataSource) envCtx.lookup("jdbc/DBDevTrackConnDS");
|   } catch (NamingException e) {
|      e.printStackTrace();
|   }
| %>

Why do you allow processing to continue if there is an exception getting
the DataSource? There is nothing useful your JSP can do if the
DataSource is not successfully obtained. My guess is that you are
getting a NullPointerException below...

[snip]

|   try {
[snip]
|     }
[snip]
|   }
|   catch (SQLException e) {
|   }
|   catch (Exception e) {
|   }

... which you can't see because you are swallowing all exceptions.

| javax.naming.NameNotFoundException: Name jdbc is not bound in this Context

This is another problem that is definitely the cause of your problems.
It's good that you had this problem, so you'd ask a question and see all
of the /other/ problems that you didn't know you had in the first place.

| I have been using the same try{} blocks in my servlet files.

Your try/catch idiom leaks connections, statements, and result sets. :(
You should fix that, too.

| The connection
| to the same database has always be successful and the data records are
| retrieved.  I figure that the only difference between the servlets and the
| jsp is that the servlet has the binding information for the database
in the
| appName/META-INF/context.xml file:

Why would you think that? Are you running your servlets and JSPs in
different webapps? If not, then the context.xml file specifies setup for
all servlets in a webapp (including those translated from JSP).

- -chris

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.8 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkezfj0ACgkQ9CaO5/Lv0PBjIwCZAVMjTBygZj1iDvCNQY9hWKka
xrMAn0/uF81TI4V1ydvJ+s1rbLndVAb9
=Sn3x
-----END PGP SIGNATURE-----

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

Reply via email to