Received: from localhost (maia-2.hub.org [200.46.204.187]) by postgresql.org (Postfix) with ESMTP id 0C8639F93A2 for ; Fri, 22 Dec 2006 04:03:01 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.187]) (amavisd-new, port 10024) with ESMTP id 85116-06 for ; Fri, 22 Dec 2006 04:02:47 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.4 Received: from nz-out-0506.google.com (nz-out-0506.google.com [64.233.162.225]) by postgresql.org (Postfix) with ESMTP id 4DA039F9A72 for ; Fri, 22 Dec 2006 04:02:49 -0400 (AST) Received: by nz-out-0506.google.com with SMTP id m7so1180807nzf for ; Fri, 22 Dec 2006 00:02:48 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:mime-version:content-type; b=F1XkXO7DnemQtwvAwmX2DShVo15qJeA2OWExon8/j1XkeWRdN8DvAU2TZk/v+xJ7tcwl0vnhMsl2Yk/hv2EIfp02JXwVz0dUnoAUJTRBxpKee17H1xJvf+4OoWctBuTS3zbPyQ/YIKZ5xQEJ1KDi340QHZoi5NTY7VLkR2gDZ2o= Received: by 10.65.114.4 with SMTP id r4mr12310075qbm.1166774568411; Fri, 22 Dec 2006 00:02:48 -0800 (PST) Received: by 10.64.76.2 with HTTP; Fri, 22 Dec 2006 00:02:48 -0800 (PST) Message-ID: Date: Fri, 22 Dec 2006 13:32:48 +0530 From: "janaka priyadarshana" To: pgsql-jdbc@postgresql.org Subject: Connection pooling in java MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_35418_27869084.1166774568363" X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200612/115 X-Sequence-Number: 16347 ------=_Part_35418_27869084.1166774568363 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline 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........... ------=_Part_35418_27869084.1166774568363 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline 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........... ------=_Part_35418_27869084.1166774568363--