Skip site navigation (1) Skip section navigation (2)

JNDI & Others

From: renyu teng <renyu_teng(at)yahoo(dot)com>
To: postgresql <pgsql-cygwin(at)postgresql(dot)org>
Subject: JNDI & Others
Date: 2001-11-02 22:30:29
Message-ID: (view raw or whole thread)
Lists: pgsql-cygwin
Hi guys,

below is the msg I have searched in the archive files,
and I have similiar questions, and if anyone knows the
anwsers, could you please drop me a mail.

I use MS 2000. 

Actually I am stuck here with the following msg:

set up:java.naming.factory.initial

Hi  Larry Mulcahy. are you still on this list? if yes,
could you please drop me a mail and tell me how to set
up env. so I could use jndi to get the connection.


I have continued working on this and have learned some
things I
didn't understand when I asked this question.

I have succeeded in deploying a PostgreSQL DataSource
using the
file system service provider 
 I have
one small Java application that binds the DataSource
to a name,
then another application can do a lookup on that name,
do a 
getConnection on the DataSource and with that access
the database.

Now, I'd like to do connection pooling.  After poring
over the
archived messages of pgsql-jdbc and looking at the
source code,
I'm having a hard time determining whether it's
possible to do
this (without using some other software like PoolMan,
or Tyrex).  Some of the messages in the mailing list
such as
suggest that the ConnectionPoolDataSource interface
ought to be
implemented, but I can't find any classes in the
"enterprise" jar 
file or in the source tree that sound like this.

Is ConnectionPoolDataSource implemented?

Larry Mulcahy wrote:
> I'm trying to create a data source as described in
> 5.5.1 of the JDBC 2.0 Standard Extension API
> (Another example: paragraph 3.7.2 "Deploying a Basic
> Object" in
> My application produces the output,
> java -classpath
> Example
> Creating a new Context...
> Binding...
> Bind failed.
> Exception: javax.naming.NoInitialContextException:
Need to specify class
> name in environment or system property, or as an
applet parameter, or in
> an application resource file: 
> I found various documentation about different ways
to specify a value
> for java.naming.factory.initial.  You can put it in
> $JAVA_HOME/lib/, you can specify it
on the command line
> with -Djava.naming.factory.initial=..., you can
create an environment
> Hashtable and pass it as one of the arguments to
InitialContext as
> documented at
> What I can't find is what value to actually give it
for the
> InitialContextFactory.  Am I supposed to write this
> This seems like a routine common action that people
must do all the
> time, but I can't seem to find good documentation
about how to do it.
> Is there some administration that needs to be done
behind the scenes,
> e.g. starting a JNDI server?
> Code follows:
> import javax.naming.InitialContext;
> import javax.naming.Context;
> import java.util.Hashtable;
> public class Example {
>     public static void main(String args[])
>     {
>         org.postgresql.PostgresqlDataSource ds =
>             new
>         ds.setServerName("host");
>         ds.setDatabaseName("database");
>         Context ctx = null;
>         System.out.println("Creating a new
>         try {
>             ctx = new InitialContext();
>         }
>         catch (Exception e) {
>             System.out.println("Failed to create a
new Context.");
>             System.out.println("Exception: " + e);
>             return;
>         }
>         System.out.println("Binding...");
>         try {
>             ctx.bind("jdbc/database", ds);
>         }
>         catch (Exception e) {
>             System.out.println("Bind failed.");
>             System.out.println("Exception: " + e);
>             return;
>         }
>     }
> }

	    Larry Mulcahy		lmulcahy(at)qip(dot)qwest(dot)net
			  PGP public key at:

Do You Yahoo!?
Find a job, post your resume.

pgsql-cygwin by date

Next:From: Jason TishlerDate: 2001-11-03 03:59:07
Subject: Re: Problem starting as service.
Previous:From: Dave PageDate: 2001-11-02 21:21:07
Subject: Re: Problems with Windows XP

Privacy Policy | About PostgreSQL
Copyright © 1996-2015 The PostgreSQL Global Development Group