Re: jdbc servlets and jsp

From: Paul Thomas <paul(at)tmsl(dot)demon(dot)co(dot)uk>
To: "pgsql-jdbc (at) postgresql (dot) org" <pgsql-jdbc(at)postgresql(dot)org>
Subject: Re: jdbc servlets and jsp
Date: 2003-09-08 22:05:24
Message-ID: 20030908230524.A1608@bacon
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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 |
+------------------------------+---------------------------------------------+

In response to

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message James Robinson 2003-09-09 00:57:04 Re: JBoss w/int8 primary keys in postgres ...
Previous Message Luke Vanderfluit 2003-09-08 19:52:07 jdbc servlets and jsp