⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 xamorph.out

📁 derby database source code.good for you.
💻 OUT
字号:
ij> disconnect;ij> ---- testing using an xaConnection alternately produce local and global-- transaction ----xa_datasource 'wombat' ;ij> xa_connect user 'sku' password 'testmorph';ij> -- get a local connection thru the XAConnectionxa_getconnection;ij> run resource '/org/apache/derbyTesting/functionTests/tests/store/global_xactTable.view';ij> create view global_xactTable asselect     cast(global_xid as char(2)) as gxid,    status,    case when first_instant is NULL then 'NULL' else 'false' end as readOnly,    cast (username as char(10)) as username,    type from new org.apache.derby.diag.TransactionTable() t;0 rows inserted/updated/deletedij> select * from global_xactTable where gxid is not null order by gxid,username;GXID|STATUS  |READ&|USERNAME  |TYPE                          -------------------------------------------------------------ij> drop table foo;ERROR 42Y55: 'DROP TABLE' cannot be performed on 'FOO' because it does not exist.ij> create table foo (a int);0 rows inserted/updated/deletedij> commit;ij> autocommit off;ij> insert into foo values (1);1 row inserted/updated/deletedij> select * from global_xactTable where gxid is not null order by gxid,username;GXID|STATUS  |READ&|USERNAME  |TYPE                          -------------------------------------------------------------ij> commit;ij> autocommit on;ij> insert into foo values (2);1 row inserted/updated/deletedij> select * from global_xactTable where gxid is not null order by gxid,username;GXID|STATUS  |READ&|USERNAME  |TYPE                          -------------------------------------------------------------ij> -- morph the connection to a global transactionxa_start xa_noflags 1;ij> select * from global_xactTable where gxid is not null order by gxid,username;GXID|STATUS  |READ&|USERNAME  |TYPE                          -------------------------------------------------------------(1  |IDLE    |NULL |SKU       |UserTransaction               ij> insert into foo values (3);1 row inserted/updated/deletedij> -- disallowedcommit;ERROR XJ057: Cannot commit a global transaction using the Connection, commit processing must go thru XAResource interface.ij> -- disallowedrollback;ERROR XJ058: Cannot rollback a global transaction using the Connection, commit processing must go thru XAResource interface.ij> -- disallowedautocommit on;ERROR XJ056: Cannot set AUTOCOMMIT ON when in an XA connection.ij> -- OKautocommit off;ij> select * from foo;A          -----------1          2          3          ij> xa_end xa_success 1;ij> xa_prepare 1;ij> -- dup idxa_start xa_noflags 1;IJ ERROR: XAER_DUPID ij> xa_start xa_noflags 2;ij> -- still should disallow autommit;autocommit on;ERROR XJ056: Cannot set AUTOCOMMIT ON when in an XA connection.ij> -- still should disallow commit and rollback commit;ERROR XJ057: Cannot commit a global transaction using the Connection, commit processing must go thru XAResource interface.ij> rollback;ERROR XJ058: Cannot rollback a global transaction using the Connection, commit processing must go thru XAResource interface.ij> select * from global_xactTable where gxid is not null order by gxid,username;GXID|STATUS  |READ&|USERNAME  |TYPE                          -------------------------------------------------------------(1  |PREPARED|false|SKU       |UserTransaction               (2  |IDLE    |NULL |SKU       |UserTransaction               ij> xa_end xa_suspend 2;ij> -- get local connection againxa_getconnection;ij> insert into foo values (5);1 row inserted/updated/deletedij> -- autocommit should be on by default;commit;ij> autocommit off;ij> insert into foo values (6);1 row inserted/updated/deletedij> -- commit and rollback is allowed on local connectionrollback;ij> insert into foo values (6);1 row inserted/updated/deletedij> commit;ij> select * from global_xactTable where gxid is not null order by gxid,username;GXID|STATUS  |READ&|USERNAME  |TYPE                          -------------------------------------------------------------(1  |PREPARED|false|SKU       |UserTransaction               (2  |IDLE    |NULL |SKU       |UserTransaction               ij> -- I am still able to commit other global transactions while I am attached to a-- local transaction.xa_commit xa_2phase 1;ij> xa_end xa_success 2;ij> xa_rollback 2;ij> -- still connected locallyselect * from global_xactTable where gxid is not null order by gxid,username;GXID|STATUS  |READ&|USERNAME  |TYPE                          -------------------------------------------------------------ij> disconnect;ij> xa_getconnection;ij> select * from global_xactTable where gxid is not null order by gxid,username;GXID|STATUS  |READ&|USERNAME  |TYPE                          -------------------------------------------------------------ij> select * from foo;A          -----------1          2          3          5          6          ij> autocommit off;ij> delete from foo;5 rows inserted/updated/deletedij> -- yanking a local connection away should rollback the changes-- this really depends on if the connection pool manage is doing the job, roll-- it back by hand here since we don't have a way to call local pooled-- connection close method.rollback;ij> -- yank itxa_getconnection;ij> -- getting a new connection handle will revert it to the default autocommit on-- commit should failcommit;ij> autocommit off;ij> select * from global_xactTable where gxid is not null order by gxid,username;GXID|STATUS  |READ&|USERNAME  |TYPE                          -------------------------------------------------------------ij> select * from foo;A          -----------1          2          3          5          6          ij> -- cannot morph it if the local transaction is not idlexa_start xa_noflags 3;IJ ERROR: XAER_OUTSIDE ij> commit;ij> -- now morph it to a global transactionxa_start xa_noflags 3;ij> -- now I shouldn't be able to yank itxa_getconnection;ERROR XJ059: Cannot close a connection while a global transaction is still active.ij> -- the following does not use the view, or the method alias, so that-- the act of executing this vti does not change the state of the transaction.-- Using the view would sometimes changes the results of the query depending-- on the order of the rows in the vti.select     cast(global_xid as char(2)) as gxid,    status,     username,     type from new org.apache.derby.diag.TransactionTable() t order by gxid, status, username, type;GXID|STATUS  |USERNAME                                                                                                                        |TYPE                          -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------(3  |IDLE    |SKU                                                                                                                             |UserTransaction               ij> select * from foo;A          -----------1          2          3          5          6          ij> delete from foo;5 rows inserted/updated/deletedij> xa_end xa_fail 3;IJ ERROR: XA_RBROLLBACK ij> xa_rollback 3;ij> -- local connection againxa_getconnection;ij> select * from global_xactTable where gxid is not null order by gxid,username;GXID|STATUS  |READ&|USERNAME  |TYPE                          -------------------------------------------------------------ij> select * from foo;A          -----------1          2          3          5          6          ij> 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -