Hi,
 
     I am facing typical problem with connection pooling, Whenever I use pooling stuff , It creating deadlocks in database. If  I use directly(like DriverManager.getConnection(url, prop);)  it is working fine . This connection stuff called in  BMP(App Server is WebSphere3.02 ). Please throw some ideas.
 
thx
Siva.
 
     Connection Pooling code 
        dataSourceName = "jdbc/PCIQ";
      hostname = "DBServer";
      port = 900;
      username = "Admin001";
      password = "Admin001";
 
  //  Setup the parameters to get the initial context
  Hashtable parms = new Hashtable();
  parms.put(Context.INITIAL_CONTEXT_FACTORY, "com.ibm.ejs.ns.jndi.CNInitialContextFactory");
  parms.put(Context.PROVIDER_URL, "iiop://" + hostname + ":" + port);
  //parms.put("user", username);
  //parms.put("password", password);
  //  Get the initial context
  Debug.println("Attempt to create initial context.");
  InitialContext context = new InitialContext(parms);
  //  Now create a data source
  Debug.println("Attempt to access data source: " + dataSourceName);
  DataSource ds = (DataSource) context.lookup(dataSourceName);
 
  // Try and get a connection
  Debug.println("Attempt to get database connection.");
  conn = ds.getConnection(username, password);
  System.out.println("Connection successful.");
 }
 catch (Exception e)
 {
  e.printStackTrace();
 }
 
 
 

Reply via email to