DataSource lookup

From: "Nico" <nicohmail-postgresql(at)yahoo(dot)com>
To: pgsql-jdbc(at)postgresql(dot)org
Subject: DataSource lookup
Date: 2005-04-03 09:33:03
Message-ID: d2od8k$c4s$1@news.hub.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

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.

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Chris White (cjwhite) 2005-04-03 20:27:36 Re: JDBC and transactions
Previous Message Kris Jurka 2005-04-02 07:33:13 Re: JDBC and transactions