|
two-phase transaction MQSeries and DB2
|
|||
---|---|---|---|
#18+
Does anybody have an experience with subj? I'd like to ask a few question, but since it's an off-topic here we may use email. ... |
|||
:
Нравится:
Не нравится:
|
|||
16.04.2004, 12:26 |
|
two-phase transaction MQSeries and DB2
|
|||
---|---|---|---|
#18+
я все знаю про w2k OS/400 и OS/390. под юникс только в теории ... |
|||
:
Нравится:
Не нравится:
|
|||
16.04.2004, 12:45 |
|
two-phase transaction MQSeries and DB2
|
|||
---|---|---|---|
#18+
какой вопрос? ... |
|||
:
Нравится:
Не нравится:
|
|||
16.04.2004, 12:47 |
|
two-phase transaction MQSeries and DB2
|
|||
---|---|---|---|
#18+
I know nothing about windows, as/400 and OS/390 :) But as/400 is my close target, OS/390 is my future targent, windows is not a target at all :) NewYear: shell we go off-line? Email or? Or is it ok to talk here? it's a DB2 forum, not dedicated for MQSeries. ... |
|||
:
Нравится:
Не нравится:
|
|||
16.04.2004, 14:07 |
|
two-phase transaction MQSeries and DB2
|
|||
---|---|---|---|
#18+
It is not a DB2 forum already :). It is an "IBM and IBM-technology near DB2" forum IMHO. Post here, please, it would be usefull for me and the others, i think. ... |
|||
:
Нравится:
Не нравится:
|
|||
16.04.2004, 14:17 |
|
two-phase transaction MQSeries and DB2
|
|||
---|---|---|---|
#18+
... |
|||
:
Нравится:
Не нравится:
|
|||
16.04.2004, 14:24 |
|
two-phase transaction MQSeries and DB2
|
|||
---|---|---|---|
#18+
1) qm.ini : XAResourceManager: Name=sms SwitchFile=/opt/IBM/db2/V8.1/function/db2swit XAOpenString=sms,mqm,droolt-Er ThreadOfControl=THREAD 2) CLI code : // Allocate a connection handler sqlret = SQLAllocHandle(SQL_HANDLE_DBC, henv, &(hcon->hdbc)); // Set AUTOCOMMIT off sqlret = SQLSetConnectAttr(hcon->hdbc, SQL_ATTR_AUTOCOMMIT, ( void * ) SQL_AUTOCOMMIT_OFF, SQL_NTS); // Connect the new connection sqlret = SQLConnect(hcon->hdbc, server, SQL_NTS, NULL, 0, NULL, 0); // Set Cusrsor Close Behavior sqlret = SQLSetConnectAttr(hcon->hdbc, SQL_ATTR_CLOSE_BEHAVIOR, ( void * ) SQL_CC_RELEASE, SQL_NTS); // Set Isolation Level sqlret = SQLSetConnectAttr(hcon->hdbc, SQL_ATTR_TXN_ISOLATION, ( void * ) SQL_TXN_READ_COMMITTED, SQL_NTS); MQCONN(qmgr, hcon, &CompCode, &Reason); MQOPEN(*hcon, &(obj->od), obj->O_options, &(obj->hobj), &CompCode, &Reason); /* Start a UOW */ MQBEGIN (hcon.mqcon, &bo, &CompCode, &Reason); MQGET(hcon.mqcon, obj.hobj, &(obj.md), &(obj.op.gmo), sizeof(struct SMS), &sSMS, &messlen, &CompCode, &Reason); /* A set of SQL statements here */ ............................. MQCMIT(*mqcon, &CompCode, &Reason); And at this point the UOF is commited in the queue only, and is not commited in the database. If I, for example, do "select" from another connection I will get timeout. When the program finished the queue is empty, the database is rolled back. The question is - what I do wrong, and why firt phase (queue's commit/rollback) works but the second phase (database's commit/rollback) does not work? ... |
|||
:
Нравится:
Не нравится:
|
|||
19.04.2004, 10:57 |
|
two-phase transaction MQSeries and DB2
|
|||
---|---|---|---|
#18+
в программе не должно быть connect к db2, потому что коннект делает queue manager. это происходит во время MQBEGIN() вызова. т.е. программа должна выглядеть так MQCONN() MQBEGIN() EXEC SQL SET CONNECTION; ............. ДВУХФАЗНЫЕ ТРАНЗАКЦИИ .............. MQCMIT(); у тебя получилось разные коннекты в y queue mаnager и в программе? к сожалению, здесь cli, а не esql. ... |
|||
:
Нравится:
Не нравится:
|
|||
19.04.2004, 11:21 |
|
two-phase transaction MQSeries and DB2
|
|||
---|---|---|---|
#18+
если 2 раза подконнектиться к db2 что будет? вернется ли тот же самый handle если ThreadOfControl=PROCESS ? в MQ именно так и происходит и возвращается MQRC_ALREDY_CONNECTED warning. токжа ты сможешь сделать connect уже после MQBEGIN() и получить handle. ... |
|||
:
Нравится:
Не нравится:
|
|||
19.04.2004, 11:34 |
|
two-phase transaction MQSeries and DB2
|
|||
---|---|---|---|
#18+
Ok, I may change to esql. But looking at /opt/mqm/samp/xatm/ I see at amqsxag0.c the sequence: MQCONN MQOPEN MQBEGIN MQGET EXEC SQL CONNECT TO different sql statements and multiple EXEC SQL CONNECT to different databases MQCMIT In the example IBM shows EXEC SQL CONNECT between MQBEGIN and MQCMIT.... it confuses me.... And I read in the doc somewhere (now will find it) that a working program has two connection - one from the program itself and another from MQ.... But I am not sure and will check it now. ... |
|||
:
Нравится:
Не нравится:
|
|||
19.04.2004, 11:47 |
|
two-phase transaction MQSeries and DB2
|
|||
---|---|---|---|
#18+
you are alredy connected after MQBEGIN, why connect? in additional, specify db2 prep acces.sqc bindfile CONNECT 2 SYNCPOINT TWOPHASE SQLRULES STD ... |
|||
:
Нравится:
Не нравится:
|
|||
19.04.2004, 12:14 |
|
two-phase transaction MQSeries and DB2
|
|||
---|---|---|---|
#18+
я понил про что ты говоришь. EXEC SQL CONNECT TO different sql statements and multiple EXEC SQL CONNECT to different databases считай что это set connection. это не connect к базе. ... |
|||
:
Нравится:
Не нравится:
|
|||
19.04.2004, 12:58 |
|
two-phase transaction MQSeries and DB2
|
|||
---|---|---|---|
#18+
I can read russian perfectly, I just can not type. I understand that after MQBEGIN we get connected to a database. I just told that IBM examples from /opt/mqm/sampl/xatm confuses me. Now I change to embedded SQL, because does not see any way how to handle global UOW with CLI, and you NewYear may have a look at IBM example, I send it now by email :) I don't know why, but IBM has EXEC SQL CONNECT between MQBEGIN and MQCMIT in their example. Email's been sent. ... |
|||
:
Нравится:
Не нравится:
|
|||
19.04.2004, 13:00 |
|
two-phase transaction MQSeries and DB2
|
|||
---|---|---|---|
#18+
Ok, thanks, got it, now rewriting it to embedded SQL, (but I believe it must work with CLI) ... |
|||
:
Нравится:
Не нравится:
|
|||
19.04.2004, 13:07 |
|
two-phase transaction MQSeries and DB2
|
|||
---|---|---|---|
#18+
from manual If the CONNECT is for an application server on a dormant connection, it becomes the current connection. Connecting to a dormant connection using CONNECT is only allowed if SQLRULES(DB2) was specified. If SQLRULES(STD) was specified, then the SET CONNECTION statement must be used instead. то что в exaple это dormant connection, отсюда путаница. сделал IBM один и тот же statement, хотя для разных целей. >but I believe it must work with CLI ну, я не такой оптимист, что-то не помню, чтоб можно было писать на cli. а может просто я не помню. ... |
|||
:
Нравится:
Не нравится:
|
|||
19.04.2004, 13:43 |
|
two-phase transaction MQSeries and DB2
|
|||
---|---|---|---|
#18+
yeah, thanks. I did not find anything about distributed transaction an CLI. Seems I have to rewrite a huge legacy multithreaded application written on CLI for v7.1. Now I'm rewriting a small part, just to get sure it works all together. ... |
|||
:
Нравится:
Не нравится:
|
|||
19.04.2004, 14:38 |
|
two-phase transaction MQSeries and DB2
|
|||
---|---|---|---|
#18+
After rewriting to Embedded SQL and without explicit CONNECT as NewYear suggested two-phase transaction works perfectly. But the next issue is in place: /* pseudo-code */ EXEC SQL DECLARE... while(1){ MQBEGIN GET EXEC SQL SET CONNECTION EXEC SQL PREPARE EXEC SQL ....... MQCMIT } PREPARE is in cycle.... as well as SET CONNECTION. The single solution I see is : if(first_loop_in_cycle){ EXEC SQL SET CONNECTION EXEC SQL PREPARE } I thought I could insert MQSEND/MQRECEIVE into CLI code instead to rewrite everything to embedded SQL, but MQSEND/MQRECEIVE functions are based on AMI, it is restriction itself, and it is not so flexible.. Seems it is not an option. I have a message body a struct{} with many fields, and don't see yet how could I handle it with AMI. Any AMI users? But with 'context' usage (appeared in v8.1) I may rewrite CLI multithreaded to ESQL multithreaded. ... |
|||
:
Нравится:
Не нравится:
|
|||
20.04.2004, 10:28 |
|
two-phase transaction MQSeries and DB2
|
|||
---|---|---|---|
#18+
я ничего не помял что тебя смущает. причем message body? AMI - suxx, MQI forever. ... |
|||
:
Нравится:
Не нравится:
|
|||
20.04.2004, 11:10 |
|
two-phase transaction MQSeries and DB2
|
|||
---|---|---|---|
#18+
AMI - suxx, MQI forever --- yes, but MQSEND/MQRECEIVE in DB2 uses AMI... I thought to use MQSEND/MQSEREIVE, but seems I won't... Prefer to use MQI and control SQL transaction from it, than to use MQSEND/MQRECEIVE... But I'm in doubt. sqleBeginCtx() MQBEGIN() EXEC SQL SET CONNECTION will we get here a connection under defined context ? I think we will, usually we use sqleBeginCtx() EXEC SQL CONNECT but MQBEGIN & SET CONNECTION replace CONNECT... Because as I said it's a multithreaded program. ... |
|||
:
Нравится:
Не нравится:
|
|||
21.04.2004, 11:05 |
|
|
start [/forum/topic.php?fid=43&fpage=156&tid=1606299]: |
0ms |
get settings: |
9ms |
get forum list: |
14ms |
check forum access: |
4ms |
check topic access: |
4ms |
track hit: |
43ms |
get topic data: |
12ms |
get forum data: |
3ms |
get page messages: |
57ms |
get tp. blocked users: |
2ms |
others: | 289ms |
total: | 437ms |
0 / 0 |