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 11744536D0 for ; Sun, 3 Apr 2005 21:52:21 +0100 (BST) 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 58388-03 for ; Sun, 3 Apr 2005 20:52:14 +0000 (GMT) Received: from bench.chipcity.com.au (dialup-229.56.221.203.acc06-waym-adl.comindico.com.au [203.221.56.229]) by svr1.postgresql.org (Postfix) with ESMTP id 446F5535FE for ; Sun, 3 Apr 2005 21:52:08 +0100 (BST) Received: from bench.chipcity.com.au (bench.chipcity.com.au [127.0.0.1]) by bench.chipcity.com.au (8.12.8/8.12.8) with ESMTP id j33KsagC003638 for ; Mon, 4 Apr 2005 06:24:37 +0930 Received: (from luke@localhost) by bench.chipcity.com.au (8.12.8/8.12.8/Submit) id j33KsZJv003636 for pgsql-jdbc@postgresql.org; Mon, 4 Apr 2005 06:24:35 +0930 Date: Mon, 4 Apr 2005 06:24:35 +0930 From: luke@chipcity.com.au To: pgsql-jdbc@postgresql.org Subject: Re: DataSource lookup Message-ID: <20050403205435.GB1806@bench.chipcity.com.au> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4i X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=2.02 tagged_above=0 required=5 tests=FORGED_RCVD_HELO, NO_REAL_NAME, RCVD_IN_NJABL_DUL, RCVD_IN_SORBS_DUL X-Spam-Level: ** X-Archive-Number: 200504/8 X-Sequence-Number: 12615 Hi, 03Apr2005 @ 11:33 Nico thusly spake > How do I find out what's the name of the JNDI data source I need for a > PostgreSQL connection pool? > Currently I do this, > > javax.naming.Context env=(javax.naming.Context) > new javax.naming.InitialContext().lookup("java:comp/env"); > pool=(DataSource)env.lookup("jdbc/"+dbname); > connection=pool.getConnection("username","password"); > > but then I get a MySQL connection(MySQL & PostgreSQL run both on server). > I only have permission to my personal account, not the shared directories > where I think the jndi resources are located. In my web.xml are no resources > defined. You can define the datasource in the context.xml file in the META-INF directory in your webapp. You should have permissions for that because you should have permissions for the webapp You can also define a datasource in the server.xml file, however that is in the 'server-root' conf file and it sounds like you don't have permission for that. Here is an example from a context.xml file: -this one is connecting to a cloudscape database, see 'driverClassName' (for postgres: 'org.postgresql.Driver') -the url for a postgresql database would be 'jdbc:postgresql:dbname' ___________________________ / WEB-INF/web.xml \_____________________________ hth, Luke -- ............._ .| .| |.|/.|_ .|__.|_|.|\.|_ .0421 276 282.