XA事务中的DB2和ORACLE [英] DB2 and ORACLE in XA transaction
问题描述
嗨!
我在一台服务器上使用DB2数据库,在第二台服务器上使用ORACLE数据库。
我想从中移动一些数据ORACLE数据库到DB2数据库并更新
ORACLE数据库上的一些列,所以我知道哪些行被转移了。我希望
喜欢在分布式XA事务和Java中执行此操作。 :)
这怎么可能?
祝你好运,
Kovi
-
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 〜 - 〜 - 〜 -
|在一个没有围栏需要盖茨的世界里? |
|体验Linux。 |
- 〜 - 〜 - 〜 - 〜 - 〜 - 〜 - ~~~~~~~~~~~~~~~~~~~~~~ 〜 - 〜 - 〜 - 〜 -
Hi!
I''m using DB2 database on one server and ORACLE database on the second one.
I want to move some data from ORACLE database to DB2 database and update
some columns on ORACLE database so I know what rows were transfered. I''d
like to do this in a distributed XA transaction and Java. :)
How is this possible ?
Best regards,
Kovi
--
-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
| In A World Without Fences Who Needs Gates? |
| Experience Linux. |
-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
推荐答案
Gregor Kova ??写道:
Gregor Kova?? wrote:
嗨!
我在一台服务器上使用DB2数据库,在第二台服务器上使用ORACLE数据库/>
一个。我想将一些数据从ORACLE数据库移动到DB2数据库并且
更新ORACLE数据库上的一些列,这样我知道哪些行是转移的
。我想在分布式XA事务和Java中这样做。
:)这怎么可能?
Hi!
I''m using DB2 database on one server and ORACLE database on the second
one. I want to move some data from ORACLE database to DB2 database and
update some columns on ORACLE database so I know what rows were
transfered. I''d like to do this in a distributed XA transaction and Java.
:) How is this possible ?
我不确定你的问题是什么。我的答案是:向DB2打开一个XA
事务,向Oracle打开另一个事务,执行你想要的操作,然后执行两阶段提交。
-
Knut Stolze
DB2 z / OS实用程序开发
IBM德国>
Knut Stolze写道:
Knut Stolze wrote:
Gregor Kova ??写道:
Gregor Kova?? wrote:
>嗨!
我在一台服务器上使用DB2数据库,在第二台上使用ORACLE数据库
一。我想将一些数据从ORACLE数据库移动到DB2数据库并更新ORACLE数据库上的一些列,这样我就知道哪些行被转移了。我想在分布式XA事务和Java中这样做。
:)这怎么可能?
>Hi!
I''m using DB2 database on one server and ORACLE database on the second
one. I want to move some data from ORACLE database to DB2 database and
update some columns on ORACLE database so I know what rows were
transfered. I''d like to do this in a distributed XA transaction and Java.
:) How is this possible ?
我不确定你的问题是什么。我的答案是:向DB2打开一个XA
事务,向Oracle打开另一个事务,执行你想要的操作
,然后执行两阶段提交。
I''m not sure what your question is. My answer would be: open one XA
transaction to DB2, another one to Oracle, do the operations you want to
do, then perform a two-phase commit.
或者购买Oracle的异构服务(以前是
透明网关)。但是如果没有版本信息,你会要求
人们在黑暗中拍摄。
-
Daniel A. Morgan
华盛顿大学
da******@x.washington.edu
(用u代替x来回复)
Puget Sound Oracle用户组
www.psoug.org
Knut Stolze写道:
Knut Stolze wrote:
Gregor Kova ??写道:
Gregor Kova?? wrote:
>嗨!
我在一台服务器上使用DB2数据库,在第二台上使用ORACLE数据库
一。我想将一些数据从ORACLE数据库移动到DB2数据库并更新ORACLE数据库上的一些列,这样我就知道哪些行被转移了。我想在分布式XA事务和Java中这样做。
:)这怎么可能?
>Hi!
I''m using DB2 database on one server and ORACLE database on the second
one. I want to move some data from ORACLE database to DB2 database and
update some columns on ORACLE database so I know what rows were
transfered. I''d like to do this in a distributed XA transaction and Java.
:) How is this possible ?
我不确定你的问题是什么。我的答案是:向DB2打开一个XA
事务,向Oracle打开另一个事务,执行你想要的操作,然后执行两阶段提交。
I''m not sure what your question is. My answer would be: open one XA
transaction to DB2, another one to Oracle, do the operations you want to
do, then perform a two-phase commit.
谢谢你的回答。也许我有点不清楚。
在一台服务器上我有一个ORACLE数据库(不知道是什么版本,但:))。)
另一个我有DB2 v9.1。现在我想将数据从ORACLE移动到DB2,并将
从DB2移动到ORACLE。使用分布式事务可以让我在两端进行
提交/回滚,对吗?我正在使用Java而且不知道怎么做(b)b $ b。 :))
现在我有这样的事情:
//打开与ORACLE的连接
连接oracleConn = DriverManager.getConnection(... 。);
oracleConn.setautoCommit(false);
//打开与DB2的连接
连接db2Conn = DriverManager.getConnection(... 。);
db2Conn.setautoCommit(false);
//从DB2中选择数据
ResultSet rs = db2Conn.createStatement ()。executeQuery(" SELECT * FROM
TABLE1");
while(rs.next()== true)
{
//将数据插入ORACLE
//更新DB2中的一些行
}
db2Conn.commit(); // 1
oracleConn.commit(); // 2
在这个例子中,这是一个错误,因为提交到db2Conn(1)并且执行了
并且提交到oracleConn(2)可能会失败并且我最终得到数据我
不想拥有。 :))
我很好奇如何进行XA交易?我是否必须使用类似
DriverManager.getXAConnection()?
祝你好运,
Kovi
< br $> b $ b -
- 〜 - 〜 - 〜 - ~~~~~~~~~~~~~~~~~~~~~ 〜 - 〜 - 〜 - 〜 - 〜 - 〜 - 〜 - 〜 -
|在一个没有围栏需要盖茨的世界里? |
|体验Linux。 |
- 〜 - 〜 - 〜 - 〜 - 〜 - 〜 - ~~~~~~~~~~~~~~~~~~~~~~ 〜 - 〜 - 〜 - 〜 -
Thanks for you answer. Maybe I was a bit unclear.
On one server I have an ORACLE database (don''t know what version, yet :)) ).
One another I have DB2 v9.1. Now I want to move data from ORACLE to DB2 and
from DB2 to ORACLE. Using distributed transactions would allow me to do
commit/rollback on both ends, right? I''m using Java and don''t know how to
do it (yet). :))
Now I have something like this:
// Open connection to ORACLE
Connection oracleConn = DriverManager.getConnection(....);
oracleConn.setautoCommit(false);
// Open connection to DB2
Connection db2Conn = DriverManager.getConnection(....);
db2Conn.setautoCommit(false);
// select data from DB2
ResultSet rs = db2Conn.createStatement().executeQuery("SELECT * FROM
TABLE1");
while (rs.next() == true)
{
// insert data into ORACLE
// update some rows in DB2
}
db2Conn.commit(); // 1
oracleConn.commit(); // 2
In this example these is an error since commit to db2Conn (1) and be
performed and commit to oracleConn (2) can fail and I end up with data I
don''t want to have. :))
I''m curious how to do the XA transactions? Do I have to use something like
DriverManager.getXAConnection() ?
Best regards,
Kovi
--
-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
| In A World Without Fences Who Needs Gates? |
| Experience Linux. |
-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
这篇关于XA事务中的DB2和ORACLE的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!