geronimo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Vamsavardhana Reddy" <c1vams...@gmail.com>
Subject Re: Database pool problem
Date Mon, 04 Sep 2006 03:28:07 GMT
Hi Bob,

You will need to add a cast in the second line of code above.  It should
look like the following:

javax.sql.DataSource ds = (javax.sql.DataSource) ctx.lookup
("java:comp/env/jdbc/cl");

Vamsi

On 9/4/06, Bob Dushok <bdushok@mac.com> 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
> >
> >
>
>

Mime
View raw message