db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jayaram Subramanian <rsjay1...@gmail.com>
Subject Switching across connections
Date Sun, 31 Jan 2010 04:35:03 GMT
Hi,
When we have 2 connections open to a db, how can we switch between
connections and make the connection we require as active connection. I am
trying to convert the following segment to JUnit. Is there any equivalent
method of set connection described below?

With Regards
Jayaram


connect 'wombat' as conn1;
create table t1 (c11 int generated always as identity (start with 101,
increment by 3), c12 int);
create table t2 (c21 int generated always as identity (start with 201,
increment by 5), c22 int);
-- IDENTITY_VAL_LOCAL() will return NULL because no single row insert into
table with identity column yet on this connection conn1
values IDENTITY_VAL_LOCAL();
commit;
-- connection two
connect 'wombat' as conn2;
-- IDENTITY_VAL_LOCAL() will return NULL because no single row insert into
table with identity column yet on this connection conn2
values IDENTITY_VAL_LOCAL();
insert into t2 (c22) values (1);
-- IDENTITY_VAL_LOCAL() will return 201 because there was single row insert
into table t2 with identity column on this connection conn2
values IDENTITY_VAL_LOCAL();
set connection conn1;
-- IDENTITY_VAL_LOCAL() will continue to return NULL because no single row
insert into table with identity column yet on this connection conn1

Mime
View raw message