pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Nico <nicohmail-postgresql@yahoo.com>
To: pgsql-jdbc@postgresql.org
Subject: DataSource lookup
Date: Sun, 3 Apr 2005 11:33:03 +0200
Message-ID: <d2od8k$c4s$1@news.hub.org> (raw)

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.

Kind regards,
Nico. 





view thread (3+ messages)  latest in thread

Message-ID: <d2od8k$c4s$1@news.hub.org>
Permalink:  ../d2od8k$c4s$1@news.hub.org/
Also on:    postgresql.org/message-id/d2od8k$c4s$1@news.hub.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-jdbc@postgresql.org
  Cc: nicohmail-postgresql@yahoo.com
  Subject: Re: DataSource lookup
  In-Reply-To: <d2od8k$c4s$1@news.hub.org>
  References: <d2od8k$c4s$1@news.hub.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox