Samples JDK
package-info.java
1 /**
2  * \brief global temporary table with on commit delete rows;
3  * 1) create table using basicDataSource and then resuse
4  * 2) Create temporary table using jdbcTemple and then reuse
5  * 3) Create table using jdbcTemplate via sql script file and then reuse
6  *
7  * <h3>Concepts</h3>
8  * <p>
9  * <ul>
10  * <li>sqlplus login opens up a connection and session. We can close the session by doing a disconnect;</li>
11  * <li>We can again open the session by doing a connect;</li>
12  * <li>Two sqlplus processes means two connections and two sessions.</li>
13  * <li>If we do disconnect on the two sessions then we will have two connections but no sessions .</li>
14  * <li>The table is visible across the sessions.</li>
15  * <li>Data will not be visible across the sessions.</li>
16  * <li>Because of 'on commit delete rows', the data will not be available after the transaction is done.</li>
17  * </ul>
18  * </p>
19  *
20  * <h3>Steps</h3>
21  * <ul>
22  * <li>Open two sqlplus sessions.</li>
23  * <li>Run the following in any session to make sure that we start in clean state<br>truncate table tab_tmp;<br>drop table tab_tmp;</li>
24  * <li>Run the following in First session <br><i>create global temporary table tab_tmp (name VARCHAR2(30)) on commit delete rows;</i></li>
25  * <li>Run the following in Second session <br><i>select * from tab_tmp;</i><br>Second session can see the table</li>
26  * <li>Run the following in First session <br><i>insert into tab_tmp values('abc');</i></li>
27  * <li>Run the following in First session <br><i>select * from tab_tmp;</i>First session can see the row</li>
28  * <li>Run the following in Second session <br><i>select * from tab_tmp;</i><br>Second session can't see the row</li>
29  * <li>Run the following in First session <br><i>disconnect;</i></li>
30  * <li>Run the following in First session <br><i>connect;</i></li>
31  * <li>Run the following in First session <br><i>select * from tab_tmp;</i>First session can't see the row</li>
32  * <li>Run the following in First session <br><i>show autocommit;</i>autocommit should be off</li>
33  * <li>Run the following in First session <br><i>insert into tab_tmp values('abc');</i></li>
34  * <li>Run the following in First session <br><i>commit;</i></li>
35  * <li>Run the following in First session <br><i>select * from tab_tmp;</i>First session can't see the row as the data is not available after commit</li>
36  * </ul>
37  */
38 package com.freemindcafe.jdbc.sample3;