Rik,
        Thanks again.

I'm going to have to do some research on the javax.sql classes. I've used the java.sql classes for years but was completely unaware similar classes exist within javax.sql.

        Bob

On Sep 4, 2006, at 4:03 AM, Rik wrote:

Bob,

Sorry, it is java.sql.Connection not javax. You can fix the other error by casting it: javax.sql.DataSource ds = (javax.sql.DataSource)ctx.lookup ("java:comp/env/jdbc/cl");

Next time I should test an example before posting it :)

-
Rik

On Sun, 3 Sep 2006, Bob Dushok wrote:

Rik,
      Thanks for the reply.

The errors change when I make the code changes. I'm now encountering the following:

org.apache.jasper.JasperException: Unable to compile class for JSP

An error occurred at line: 12 in the jsp file: /demo/pooltest.jsp
Generated servlet error:
Type mismatch: cannot convert from Object to DataSource

An error occurred at line: 12 in the jsp file: /demo/pooltest.jsp
Generated servlet error:
javax.sql.Connection cannot be resolved to a type

       Bob

On Sep 3, 2006, at 4:55 PM, Rik wrote:

Hi,
Do you still have those errors if you replace your code with the following?
javax.naming.InitialContext ctx = new javax.naming.InitialContext();
javax.sql.DataSource ds = ctx.lookup("java:comp/env/jdbc/cl");
javax.sql.Connection con = ds.getConnection();
Rik
Within my code I attempt to access the pool as follows:

        InitialContext ctx = new InitialContext();
        DataSource ds = ctx.lookup("java:comp/env/jdbc/cl");
        Connection con = ds.getConnection();
When the page executes I receive the following errors:
org.apache.jasper.JasperException: Unable to compile class for JSP
An error occurred at line: 12 in the jsp file: /demo/pooltest.jsp
Generated servlet error:
InitialContext cannot be resolved to a type
An error occurred at line: 12 in the jsp file: /demo/pooltest.jsp
Generated servlet error:
InitialContext cannot be resolved to a type
An error occurred at line: 12 in the jsp file: /demo/pooltest.jsp
Generated servlet error:
DataSource cannot be resolved to a type
Could someone tell me what I've done incorrectly?  The process seems
straightforward, but I've done something incorrectly.
Thanks,
Bob


Reply via email to