users@glassfish.java.net

Re: jakarta dbcp and glassfish connection pooling

From: <glassfish_at_javadesktop.org>
Date: Thu, 10 May 2007 04:56:10 PDT

marina
Any clue what should I do?
here is the code:

public class JNDI4ConnectionPool {

        public static void main(String args[]) throws NamingException {
                System.setProperty(Context.INITIAL_CONTEXT_FACTORY,
                                "com.sun.jndi.fscontext.RefFSContextFactory");
                System.setProperty(Context.PROVIDER_URL, "file:///tmp");
                InitialContext ic = new InitialContext();
                
                Reference cpdsRef = new Reference(
                                "org.apache.commons.dbcp.cpdsadapter.DriverAdapterCPDS",
                                "org.apache.commons.dbcp.cpdsadapter.DriverAdapterCPDS", null);
                
                cpdsRef.add(new StringRefAddr("driver", "org.postgresql.Driver"));
                cpdsRef.add(new StringRefAddr("url","jdbc:postgresql:kmaheshw"));
                cpdsRef.add(new StringRefAddr("user", "kmaheshw"));
                cpdsRef.add(new StringRefAddr("password", ""));
                try {
                        ic.rebind("jdbc/cpds", cpdsRef);
                } catch (NamingException e) {
                        // TODO Auto-generated catch block
                        e.printStackTrace();
        
                }

      }

}
[Message sent by forum member 'ketancmaheshwari' (ketancmaheshwari)]

http://forums.java.net/jive/thread.jspa?messageID=216306