Received: from localhost (unknown [200.46.204.187]) by postgresql.org (Postfix) with ESMTP id DCB3A9FC59D for ; Thu, 25 Oct 2007 20:09:13 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.187]) (amavisd-maia, port 10024) with ESMTP id 10641-09 for ; Thu, 25 Oct 2007 20:08:57 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 Received: from mx01.burntmail.com (mx01.burntmail.com [69.93.121.66]) by postgresql.org (Postfix) with ESMTP id C95F89FA361 for ; Thu, 25 Oct 2007 20:09:07 -0300 (ADT) Received: from pool-72-66-95-130.washdc.fios.verizon.net ([72.66.95.130] helo=[127.0.0.1]) by mx01.burntmail.com with esmtpa (Exim 4.63) (envelope-from ) id 1IlBox-0006hA-Fq for pgsql-jdbc@postgresql.org; Thu, 25 Oct 2007 18:08:59 -0500 Message-ID: <47212207.4070303@burntmail.com> Date: Thu, 25 Oct 2007 19:08:55 -0400 From: Guy Rouillier User-Agent: Thunderbird 2.0.0.6 (Windows/20070728) MIME-Version: 1.0 To: pgsql-jdbc@postgresql.org Subject: Re: multiple connections to db over jsp References: <47210FE5.8000909@lordlamer.de> In-Reply-To: <47210FE5.8000909@lordlamer.de> Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit X-Antivirus: avast! (VPS 071025-1, 10/25/2007), Outbound message X-Antivirus-Status: Clean X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200710/144 X-Sequence-Number: 17716 Frank Habermann wrote: > Hello folks, > > First i must say that i am relativ new with java, tomcat and servlet and > jsp. > > I know how to create a simple connection to postgresql with jdbc. I want > to create some simple pages with jsp's that uses postgresql as database. > My problem is how to implement this connection as best in jsp's. > So i want to create 10 (for example) connections to postgresql if the > application is loaded in tomcat so that if a user call a jsp over the > browser the jsp don not create a connection itself. Is this possible? I > think this is possible in a servlet. But is it possible in a jsp? > Can somebody give me some hints or some documentation for this?! Look up datasource in the Tomcat reference. Here's the link for 5.5: http://tomcat.apache.org/tomcat-5.5-doc/jndi-datasource-examples-howto.html This creates a connection pool, and in your JSP page, you just retrieve a connection from the pool when you need one. -- Guy Rouillier