You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Dave Smith <sa...@home.com> on 2000/11/04 21:41:48 UTC

Re: How to use JDBC in JSP & servlet

Viet,

When you are learning the API, obviously
your first projects will use sql Connections
inside servlets and JSP. This is not very
maintainble code, though. A better plan is to
encapsulate all the JDBC code in a layer
between the JSP and the DB:

    DB --> Persistence layer --> JSP --> User.

There is no cut and dried way to do this,
however. Yes, Connection Pooling is
essential. Again, there is no one way to do it.
For stand-alone systems you can use code from
Bitmechanics. In some environments (e.g.,
Websphere) connection pooling is built in.

A cool persistence layer can be found at
http://castor.exolabs.org/


Regards,

Dave

----- Original Message -----
From: "Viet Nguyen" <vi...@vietlink.com>
To: <to...@jakarta.apache.org>
Sent: Tuesday, January 02, 2001 1:51 PM
Subject: How to use JDBC in JSP & servlet


> I've done some programming with ASP and stand-alone JDBC apps though I'm
> completely new with JSP and servlet.  Please excuse me if these questions
> have been asked.  I'd like to how how one would use JDBC in those 2
> environments.
> 1. Should the JDBC code (open connection/execute statements..) reside in
JSP
> or in the servlet side?
> 2.  How can we effectively use JDBC connection, ie javax's connection
> pooling vs. one connection/page?
>
> thanks,
> viet.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, email: tomcat-user-help@jakarta.apache.org
>