title: How to get database connection through websphere ORB call?
body: <p>i've got a websphere 6.1 cluster environment which is composed of two nodes with 2 appservers each. Let's call <strong><code>NodeA including Server1(2809) &amp; Server2(2810)</code></strong>, <strong><code>NodeB including Server3(2811) &amp; Server4(2812)</code></strong>. Meanwhile, i created a cluster-scope datasource with JNDI <strong><code>local_db</code></strong>.</p>
  <p>Right now i want to get database connection in a java client through WAS ORB call from above environment. The specific part of java code would look like this:</p>
  <pre><code>        Hashtable env = new Hashtable();
          env.put(Context.INITIAL_CONTEXT_FACTORY,&quot;com.ibm.websphere.naming.WsnInitialContextFactory&quot;);
          env.put(Context.PROVIDER_URL,&quot;iiop://localhost:2809&quot;);  
  
          javax.sql.DataSource ds = (DataSource)initialContext.lookup(&quot;local_db&quot;);
  
          Connection cn = ds.getConnection();
  </code></pre>
  <ol>
  <li><p>If above java client code gets run, will the database connection retrieve request follow load-balancing rule among the four connection pools of all application servers?</p>
  </li>
  <li><p>Moreover, if my java client gets one database connection successfully and then run a big SQL Query with large result return, as for the memory space occupation, which WAS application server would take care? only <strong>server1</strong> due to port 2809 used above or the target server who returns the database connection?</p>
  </li>
  <li><p>BTW, if i put two server members for that <code>PROVIDER_URL</code>, such as <strong><code>iiop://localhost:2809, localhost:2810</code></strong>, does it mean load-balancing or failover?</p>
  <p>Please help explain and correct me if i'm understanding wrongly!</p>
  </li>
  </ol>
  <p>Thanks</p>