Re: jdbc servlets and jsp - Mailing list pgsql-jdbc

From Paul Thomas
Subject Re: jdbc servlets and jsp
Date
Msg-id 20030908230524.A1608@bacon
Whole thread Raw
In response to jdbc servlets and jsp  (Luke Vanderfluit <luke@chipcity.com.au>)
Responses Re: jdbc servlets and jsp  (Luke Vanderfluit <luke@chipcity.com.au>)
List pgsql-jdbc
On 08/09/2003 20:52 Luke Vanderfluit wrote:
> Hi,
>
> I'm having a few probs (fun) getting jdbc to work in servlets and jsp,
> tomcat in other words.
>
> I've successfully got jdbc working with postgresql in a regular java
> class.
>
> I have tried using the same code adapted to a servlet and jsp to get a
> database connection happening from there, however no luck,
>
> Is there anything I need to set up in server.xml or web.xml before it
> can work?
[snip]

I'm not sure why you would want to load the JDBC driver in your JSP. JSPs
are part of the view layer. Your JDBC stuff should be way back in the
persistence layer. Even servlets are really too far forward for this - use
then more as controllers. Personally, I use JSP/Struts for the
view/controller and obtain back-end connections using JNDI. The datasource
name is provided as a servlet parameter in web.xml and is passed to the
data layer on session creation. You might find it useful to look at the
j2ee design patterns at java.sun.com.

HTH

--
Paul Thomas
+------------------------------+---------------------------------------------+
| Thomas Micro Systems Limited | Software Solutions for the Smaller
Business |
| Computer Consultants         |
http://www.thomas-micro-systems-ltd.co.uk   |
+------------------------------+---------------------------------------------+

pgsql-jdbc by date:

Previous
From: Luke Vanderfluit
Date:
Subject: jdbc servlets and jsp
Next
From: James Robinson
Date:
Subject: Re: JBoss w/int8 primary keys in postgres ...