pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: janaka priyadarshana <rpjanaka@gmail.com>
To: pgsql-jdbc@postgresql.org
Subject: Connection pooling in java
Date: Fri, 22 Dec 2006 13:32:48 +0530
Message-ID: <de1942f0612220002ic31472dq4acc642fe986ebe5@mail.gmail.com> (raw)

hi all..

i am tring to use connection pool with postgresql..but it give an Exception
when it is going to execute the line following.
InitialContext().rebind("DataSource", source)


the cord is as follow.



Jdbc3PoolingDataSource source = new Jdbc3PoolingDataSource();
source.setDataSourceName("A Data Source");
source.setServerName("localhost");
source.setDatabaseName("mmsc");
source.setUser("janaka");
source.setPassword("1234");
source.setMaxConnections(10);
    try {
      new InitialContext().rebind("DataSource", source);
    }
    catch (NamingException ex) {
      System.out.println(ex.getMessage());
      ex.printStackTrace();
    }




the given exception is as follow....


javax.naming.NoInitialContextException: Need to specify class name in
environment or system property, or as an applet parameter, or in an
application resource file:  java.naming.factory.initial
    at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java
:645)
    at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java
:247)
    at javax.naming.InitialContext.getURLOrDefaultInitCtx(
InitialContext.java:284)
    at javax.naming.InitialContext.rebind(InitialContext.java:367)
    at MainClass.main(MainClass.java:29)



please help me to solve this..








-- 
...........Janaka Priyadarshana...........

view thread (3+ messages)  latest in thread

Message-ID: <de1942f0612220002ic31472dq4acc642fe986ebe5@mail.gmail.com>
Permalink:  ../de1942f0612220002ic31472dq4acc642fe986ebe5@mail.gmail.com/
Also on:    postgresql.org/message-id/de1942f0612220002ic31472dq4acc642fe986ebe5@mail.gmail.com

 · 

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: rpjanaka@gmail.com
  Subject: Re: Connection pooling in java
  In-Reply-To: <de1942f0612220002ic31472dq4acc642fe986ebe5@mail.gmail.com>
  References: <de1942f0612220002ic31472dq4acc642fe986ebe5@mail.gmail.com>

* 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