如何通过websphere ORB调用获取数据库连接? [英] How to get database connection through websphere ORB call?

查看:388
本文介绍了如何通过websphere ORB调用获取数据库连接?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个websphere 6.1集群环境,它由两个节点组成,每个节点有两个appservers。我们打电话给 NodeA,包括Server1(2809)& Server2(2810) NodeB包括Server3(2811)&服务器4(2812) 即可。同时,我创建了一个集群范围数据源,其中JNDI local_db

i've got a websphere 6.1 cluster environment which is composed of two nodes with 2 appservers each. Let's call NodeA including Server1(2809) & Server2(2810), NodeB including Server3(2811) & Server4(2812). Meanwhile, i created a cluster-scope datasource with JNDI local_db.

现在我希望通过来自上述环境的WAS ORB调用在Java客户端中获取数据库连接。 java代码的特定部分如下所示:

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:

        Hashtable env = new Hashtable();
        env.put(Context.INITIAL_CONTEXT_FACTORY,"com.ibm.websphere.naming.WsnInitialContextFactory");
        env.put(Context.PROVIDER_URL,"iiop://localhost:2809");  

        javax.sql.DataSource ds = (DataSource)initialContext.lookup("local_db");

        Connection cn = ds.getConnection();




  1. 如果以上java客户端代码运行,数据库是否会连接检索请求遵循所有应用程序服务器的四个连接池中的负载平衡规则?

  1. 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?

此外,如果我的java客户端成功获得一个数据库连接然后运行一个带有大量结果返回的大SQL查询,对于内存空间占用,哪个WAS应用服务器会注意?只有 server1 由于上面使用的端口2809或返回数据库连接的目标服务器?

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 server1 due to port 2809 used above or the target server who returns the database connection?

BTW,如果我放两台服务器 PROVIDER_URL 的成员,例如 iiop:// localhost:2809,localhost:2810 ,是指负载平衡还是故障转移?

BTW, if i put two server members for that PROVIDER_URL, such as iiop://localhost:2809, localhost:2810, does it mean load-balancing or failover?

如果我理解错误,请帮助解释并纠正我!

Please help explain and correct me if i'm understanding wrongly!

谢谢

推荐答案

让我先简单介绍一下继续其余的

Let me start with the easy ones and proceed to the rest


  1. 有两个提供者URL'意味着故障转移。如果无法连接到第一个命名服务器,它将连接到第二个命名服务器并一直持续到该列表的末尾。请注意,故障转移是连接到命名服务器(而不是资源本身)

查找是在服务器上完成的你连接到。 local_db表示该服务器上的数据源(及其连接池)。您将使用server1(当您连接到该NS时),并将从该服务器上托管的数据源获得连接。

The look up is done on the server that you connect to. THe local_db represents a datasource (and its connection pool) on that server. You will one work with the server1 (as you are connecting to that NS) and will get connection from the datasource hosted on that server.

您永远不会得到任何连接其他服务器。换句话说,没有负载平衡(一个请求使用来自server1的连接,另一个请求使用来自服务器2的连接等)。我相信这就是你在上面的问题中通过负载平衡的意思。

You will never get any connection from the other servers. In others words there is no load balancing (one request uses connection from server1, another uses a connection from server 2 etc). I believe this is what you mean by load balancing in your question above.

HTH

这篇关于如何通过websphere ORB调用获取数据库连接?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆