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 463AD536C1 for ; Mon, 4 Apr 2005 10:00:47 +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 28650-05 for ; Mon, 4 Apr 2005 09:00:41 +0000 (GMT) Received: from floppy.pyrenet.fr (news.pyrenet.fr [194.116.145.2]) by svr1.postgresql.org (Postfix) with ESMTP id 71190536B9 for ; Mon, 4 Apr 2005 10:00:39 +0100 (BST) Received: by floppy.pyrenet.fr (Postfix, from userid 106) id 031DA30952; Mon, 4 Apr 2005 11:00:26 +0200 (MET DST) From: "Nico" X-Newsgroups: pgsql.interfaces.jdbc Subject: Re: DataSource lookup Date: Mon, 4 Apr 2005 11:00:26 +0200 Organization: Hub.Org Networking Services Lines: 71 Message-ID: References: <20050403205435.GB1806@bench.chipcity.com.au> X-Complaints-To: usenet@news.hub.org X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.2527 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2527 X-RFC2646: Format=Flowed; Original To: pgsql-jdbc@postgresql.org X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=3.359 tagged_above=0 required=5 tests=FORGED_YAHOO_RCVD, PRIORITY_NO_NAME X-Spam-Level: *** X-Archive-Number: 200504/10 X-Sequence-Number: 12617 Thanks a lot, gonna try it out right away... Nico. schreef in bericht news:20050403205435.GB1806@bench.chipcity.com.au... > 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' > ___________________________ > / > > > prefix="ROOT." > suffix=".log" > timestamp="true"/> > driverClassName="COM.cloudscape.core.RmiJdbcDriver" > maxActive="4" > maxIdle="2" > maxWait="5000" > name="jdbc/dmit" > password="" > type="javax.sql.DataSource" > url="jdbc:cloudscape:rmi://localhost:1099/CloudscapeDB" > username=""/> > WEB-INF/web.xml > > \_____________________________ > > hth, > Luke > -- > ............._ > .| .| |.|/.|_ > .|__.|_|.|\.|_ > .0421 276 282. > > ---------------------------(end of broadcast)--------------------------- > TIP 8: explain analyze is your friend >