X-Original-To: pgsql-jdbc-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 655FC53935 for ; Tue, 3 May 2005 14:15:48 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 44786-06 for ; Tue, 3 May 2005 17:15:47 +0000 (GMT) Received: from mail.logix-tt.com (wallaby.dingens.org [212.75.36.180]) by svr1.postgresql.org (Postfix) with ESMTP id D322D53920 for ; Tue, 3 May 2005 14:15:46 -0300 (ADT) Received: from kingfisher.intern.logi-track.com (pD95DD5E9.dip0.t-ipconnect.de [217.93.213.233]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.logix-tt.com (Postfix) with ESMTP id 047D6A861E; Tue, 3 May 2005 19:15:47 +0200 (CEST) Received: from [127.0.0.1] (localhost [127.0.0.1]) by kingfisher.intern.logi-track.com (Postfix) with ESMTP id A3E08ACA25; Tue, 3 May 2005 19:13:51 +0200 (CEST) Message-ID: <4277B14E.5000500@logix-tt.com> Date: Tue, 03 May 2005 19:13:50 +0200 From: Markus Schaber Organization: Logical Tracking and Tracing International AG, Switzerland User-Agent: Debian Thunderbird 1.0.2 (X11/20050331) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Nico Cc: pgsql-jdbc@postgresql.org Subject: Re: mysql/posgresql pooling References: In-Reply-To: X-Enigmail-Version: 0.91.0.0 Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.05 tagged_above=0 required=5 tests=FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200505/11 X-Sequence-Number: 12842 Hi, Nico, Nico wrote: > Hi, I run a servlet that runs on a Resin 3.0.2-webserver with MySQL and > PostgreSQL database server. > Operating system is Red Hat Enterprise Linux ES release 3 (Taroon Update 4). > Resin uses its own pooling mechanism. I can make normal connections through > both MySQL and PostgreSQL. However, when I try to get a connection from a > pool, only MySQL connections are returned. How do I tell my servlet it needs > a PostgreSQL connection instead of MySQL? How do you communicate with the pool? I do not know anything about the Resin interfaces, but in jboss, you use jndi to look up your datasources by a datasource name, and have *-ds.xml files that define the datasources (map name to driver class, host name, port, username and other connection properties). To get a PostgreSQL connection, you need do deploy the appropriate definition in one of your *-ds.xml files, and then use this name when looking up your datasource. You do this along the lines of: import java.sql.Connection; import javax.naming.InitialContext; import javax.sql.DataSource; public class example { public static Connection getConnection(String name) throws Exception { InitialContext ic = new InitialContext(); DataSource dataSource = (DataSource) ic.lookup(name); return dataSource.getConnection(); } } HTH, Markus