728x90


Question

This document explains the writes on temporary table spaces during the load phase of a LOAD command

Answer

Question:

During the load phase of a LOAD command, I've seen writes against the temporary table spaces. What are those writes?

Answer:

During the first phase (the load phase ) of a LOAD command, two things happen:

  1. Rows are written into the target table
  2. Index entries are inserted into sort areas (one for each index)

So writes on temporary table spaces may happen during this phase, if sort spills happen on step 2.

To minimize these writes, make sure you have configured adequately your SORTHEAP and SHEAPTHRES, and also that the temporary table spaces have large enough buffer pools.


http://www-01.ibm.com/support/docview.wss?uid=swg21211165

http://publib.boulder.ibm.com/infocenter/db2luw/v9/index.jsp?topic=%2Fcom.ibm.db2.udb.admin.doc%2Fdoc%2Fc0004605.htm

728x90
728x90

New SQL syntax using the LIMIT and OFFSET clauses is now supported. The LIMIT clause is helpful when you want to limit the number of records returned by an SQL statement. For example, if the table USERS has 100 records, but you want to return only five records, you can use the following statement:

SELECT * FROM users LIMIT 5

The OFFSET clause indicates how many rows are skipped from the first row to start returning results. For example, if you want to return rows 11 to 15 from the table USERS, you can use the following statement:

SELECT * FROM users LIMIT 5 OFFSET 10

These two clauses are useful when you want to scroll through multiple page results in your code directly from the database rather than filtering them at the application tier.

The LIMIT and OFFSET clauses are enabled by default. However, if you find these clauses are not working, you can ensure they are enabled by executing the following commands:

$ db2set DB2_COMPATIBILITY_VECTOR=MYS
$ db2stop
$ db2start


LIMIT, OFFSET 방식은 MySQL 방식인데 DB2 9.7 fixpak 2부터 지원한다.

다음과 같이 설정할 수도 있다.

$ db2set DB2_COMPATIBILITY_VECTOR=4000


그런데 인포센터에는 해당 내용이 명시되어 있지 않다.



https://www.ibm.com/developerworks/mydeveloperworks/blogs/SQLTips4DB2LUW/entry/limit_offset?lang=en_us

http://www.ibm.com/developerworks/data/library/techarticle/dm-1006db2expressc972/index.html

http://stackoverflow.com/questions/8007243/documentation-for-db2-compatibility-vector-mys-in-db2

728x90
728x90

Installation


DB2 JDBC support is provided as part of the Java enablement option for DB2 UDB clients and servers. No special installation is required; you just need to make sure that you have the appropriate Java developer kit downloaded for your particular platform. The DB2 Information Center contains detailed information on how to set up your environment for Java on both UNIX and Windows. (See Resources.)

Table 1. Installation comparison
CLI legacy driverUniversal driver
The physical representation of the legacy-based CLI driver is the db2java.zip file.The physical representation of the universal JDBC driver is the db2jcc.jar file.
In the UNIX environment, you can use the Type 2 legacy-based driver by making sure that you have sqllib/java/db2java.zip in your CLASSPATH. The same applies to Windows.In the UNIX environment, you can use the Type 4 universal driver by making sure you have both sqllib/java/db2jcc.jar and db2jcc_license_cu.jar in the CLASSPATH. Windows instructions are the same.
The support that is enabled for this driver is JDBC 2.0 and some JDBC 3.0.Support includes most implementations of JDBC 3.0, as long as you have JDK1.4.x installed as part of your Java package.


Connection

The difference between the two JDBC drivers is shown in the way that they make their connections. The essential function of JDBC is to connect to the database and send SQL statements to the server. It has the capability of processing a result set and sending it to the requestor.

Table 2. Connection comparison
CLI legacy driverUniversal driver
The connection to the database occurs through a native database interface; in this case, DB2 uses CLI. The JDBC layer sits on top of CLI, and CLI is the native component that communicates with the database server.Everything is pure Java, and the way it communicates with the database server is though network communication. DB2 UDB uses distributed relational database architecture (DRDA) to communicate to the server and flow requests to the database server.
Since the legacy-based CLI driver requires common client code, it also requires a DLL/shared object. The DB2 product must be installed in order to use this driver.This is a pure Java driver and so can run independently of what product is installed on the machine where it runs. That is, it can be considered as a separate entity on its own and independent of the DB2 product it is shipped with.


Driver initialization

The way you actually write the code to load the driver changes depends on which driver you want to use. There are two ways the connection can be established. As with all JDBC resources, invoke the connections close method when you are done with the connection.

Table 3. Driver initialization comparison
CLI legacy driverUniversal driver
There are three essential steps needed to load and make this connection:
  1. Import the JDBC core classes (for example,import java.sql*).
  2. Load the JDBC driver Class.forName (COM.ibm.db2.jdbc.app.DB2Driver).
  3. Specify the connection URL:DriverManager getConnection jdbc:db2:coffebk.
The universal driver supports both Type 2 and Type 4 connectivity from a single driver.h network communication. DB2 UDB uses distributed relational database architecture (DRDA) to communicate to the server and flow requests to the database server.

The way you tell whether you are using the Type 2 or Type 4 driver is from the form of the connection. The following indicates that a Type 2 or Type 4 driver is being used:

jdbc:db2//server:port/database 
jdbc:db2//server/database 

The following means that a Type 2 driver is being used:
jdbc:db2:database

You have the ability to use the Type 3 driver if you want, in which case the syntax for the driver initialization will be:COM.ibm.db2.jdbc.net.DB2Driver.You can toggle between the two drivers' material layers with the connection level that you use.


Features

The introduction of DB2 UDB, Version 8 has enabled Java development to become more versatile and programming independent. Most development efforts are now focused on adding new features, improved memory management, and stability in the new JDBC Universal Driver.

Table 4. Features comparison
CLI legacy driverUniversal driver
This driver needs to specifically have the DB2 UDB product installed, as it relies on the native code of the product.This driver can be considered an independent product. It does not require the product to be installed, and it can be shipped with the many DB2 platforms that the product ships with.
Legacy driver versions are in line with DB2 UDB fix packs and, as such, are only shipped when a fix pack is released.The shipping of the JCC driver is independent of the fix pack. JCC drivers have their own versions and are shipped as needed by the release for any DB2 product. For example, DB2 V8.20 fp9 may ship with JCC driver version 2.3.9, whereas DB2 V8.20 OS/390 PTF UQ72081 may ship with JCC driver version 2.3.11.


Error handling

The two types of JDBC drivers handle errors in very different ways. The development of the error messages are still ongoing and in developing phases for the new driver, but newer versions hold more improved error handling for the universal driver. When you look at a typical JDBC exception, it will consist of an SQLErrorCode, SQLState, and SQLMessage.

Table 5. Error handling comparison
CLI legacy driverUniversal driver
The legacy driver gets its error messages from the DB2 product and essentially spits out the entire error message back to the application.The universal driver does not attempt to recreate pre-existing SQL error codes that were issued by the legacy CLI/JDBC products. The universal driver has its own defined error codes in the range +/-4200 and +/-4299.
Undefined error codes issued by the universal driver are given the error code of -99999.
If an error comes from a DB2 subsystem like DB2 server of underlying DB2 client library, then JCC will just echo that error message.


Transaction management

A transaction is a set of one or more statements that are executed together as a unit of work (UOW). Transactions are used to make sure that all transactions that are part of a UOW are executed or that none of them are executed at all. With respect to the drivers, J2EE specifies simple transaction management.

Table 6. Transaction management
CLI legacy driverUniversal driver
XA support has been enabled for this driver for a very long time.As of V8.20, XA support was enabled for the Type 4 JDBC universal driver.



http://www.ibm.com/developerworks/data/library/techarticle/dm-0512kokkat/

http://publib.boulder.ibm.com/infocenter/db2luw/v8/index.jsp?topic=/com.ibm.db2.udb.doc/ad/c0005889.htm

http://publib.boulder.ibm.com/infocenter/db2luw/v8/index.jsp?topic=/com.ibm.db2.udb.doc/ad/c0000670.htm

728x90
728x90

CREATE FUNCTION reverse(inputstring VARCHAR(100))

RETURNS VARCHAR(100)

SPECIFIC reverse

BEGIN ATOMIC

DECLARE strlength INTEGER;

DECLARE returnstring VARCHAR(100);

SET strlength =  LENGTH(inputstring);

SET returnstring = '';

WHILE strlength > 0

        DO

                SET returnstring = returnstring || SUBSTR(inputstring,strlength,1);

                SET strlength = strlength - 1;

END WHILE;


RETURN returnstring;

END@


728x90
728x90

SNAPSHOT_STATEMENT 테이블 함수

구문 도표 읽기시각적 구문 도표 생략>>-SNAPSHOT_STATEMENT--(--dbname--,--dbpartitionnum--)---------><

스키마는 SYSPROC입니다.

SNAPSHOT_STATEMENT 함수는 응용프로그램 스냅샷에서 명령문에 대한 정보를 리턴합니다.

dbname
4유형 VARCHAR(255)의 입력 인수는 함수 호출시 현재 연결된 4데이터베이스와 동일한 인스턴스에 있는 유효한 데이터베이스 이름을 지정합니다. 4LIST DATABASE DIRECTORY 명령어가 리턴한 대로 4"간접" 또는 "홈" 디렉토리 항목 유형을 갖는 데이터베이스 이름을 지정하십시오. 4데이터베이스 인스턴스 아래 있는 모든 데이터베이스에서 스냅샷을 가져오려면 널(NULL) 값을 지정하십시오.
dbpartitionnum
INTEGER의 입력 인수는 유효한 파티션 번호를 지정합니다. 현재 파티션에는 -1을, 다른 모든 파티션에는 -2를 지정하십시오. 널(NULL) 값이 지정된 경우, -1이 내재적으로 설정됩니다.

4두 매개변수가 모두 NULL로 설정된 경우 4대응되는 스냅샷 API 요청 유형에 해당하는 SNAPSHOT_FILEW 스토어드 프로시저가 4파일을 이전에 작성하지 않은 경우에만 스냅샷을 가져올 수 있습니다.

함수는 아래에 표시된 대로 테이블을 리턴합니다.

표 16. SNAPSHOT_STATEMENT 테이블 함수에서 리턴된 테이블의 컬럼 이름 및 데이터 유형
컬럼 이름데이터 유형
SNAPSHOT_TIMESTAMPTIMESTAMP
AGENT_IDBIGINT
ROWS_READBIGINT
ROWS_WRITTENBIGINT
NUM_AGENTSBIGINT
AGENTS_TOPBIGINT
STMT_TYPEBIGINT
STMT_OPERATIONBIGINT
SECTION_NUMBERBIGINT
QUERY_COST_ESTIMATEBIGINT
QUERY_CARD_ESTIMATEBIGINT
DEGREE_PARALLELISMBIGINT
STMT_SORTSBIGINT
TOTAL_SORT_TIMEBIGINT
SORT_OVERFLOWSBIGINT
INT_ROWS_DELETEDBIGINT
INT_ROWS_UPDATEDBIGINT
INT_ROWS_INSERTEDBIGINT
FETCH_COUNTBIGINT
STMT_STARTTIMESTAMP
STMT_STOPTIMESTAMP
STMT_USR_CPU_TIME_SBIGINT
STMT_USR_CPU_TIME_MSBIGINT
STMT_SYS_CPU_TIME_SBIGINT
STMT_SYS_CPU_TIME_MSBIGINT
STMT_ELAPSED_TIME_SBIGINT
STMT_ELAPSED_TIME_MSBIGINT
BLOCKING_CURSORSMALLINT
STMT_PARTITION_NUMBERSMALLINT
CURSOR_NAMEVARCHAR(128)
CREATORVARCHAR(128)
PACKAGE_NAMEVARCHAR(128)
STMT_TEXTCLOB(16M)1
1 STMT_TEXT는 장래 확장 전용으로 허용되는 CLOB(16M)으로 정의됩니다. 실제 명령문 텍스트 출력은 64K에서 절단됩니다.


모니터링 방법:

1. Database Manager 변수 DFT_MON_STMT가 on으로 설정되어 있는지 확인한다.

2. SNAPSHOT_STATEMENT 함수로 SQL을 확인한다.

db2 "select substr(stmt_text,1,50) from table(snapshot_statement('sample',-1)) as statement"

728x90
728x90

TABLE1에는 다음 네 개의 컬럼이 있다고 가정합니다.

  • C1 VARCHAR(30)
  • C2 INT GENERATED BY DEFAULT AS IDENTITY
  • C3 DECIMAL(7,2)
  • C4 CHAR(1)

TABLE2는 TABLE1과 같습니다. 다만, C2는 GENERATED ALWAYS 식별 컬럼입니다.

DATAFILE1에서 데이터 레코드(DEL 형식):

   "Liszt"
   "Hummel",,187.43, H
   "Grieg",100, 66.34, G
   "Satie",101, 818.23, I 

DATAFILE2에서 데이터 레코드(DEL 형식):

   "Liszt", 74.49, A
   "Hummel", 0.01, H
   "Grieg", 66.34, G
   "Satie", 818.23, I 
주:
  1. 다음과 같은 명령은 1과 2행에 대해 식별 값을 생성합니다. 이유는 식별 값이 DATAFILE1에서 이들 행에 제공되지 않았기 때문입니다. 하지만 3과 4행에는 사용자가 제공한 식별 값 100과 101이 각각 지정됩니다.
       db2 load from datafile1.del of del replace into table1 
  2. DATAFILE1을 TABLE1로 로드하여 식별 값이 모든 행에 대해 생성되게 하려면, 다음 명령 중 하나를 발행하십시오.
       db2 load from datafile1.del of del method P(1, 3, 4)
          replace into table1 (c1, c3, c4)
       db2load from datafile1.del of del modified by identityignore
          replace into table1 
  3. DATAFILE2를 TABLE1로 로드하여 식별 값이 각각의 행에 대해 생성되게 하려면, 다음 명령 중 하나를 발행하십시오.
       db2 load from datafile2.del of del replace into table1 (c1, c3, c4)
       db2 load from datafile2.del of del modified by identitymissing
          replace into table1 
  4. DATAFILE1을 TABLE2로 로드하여 100과 101의 식별 값이 3과 4행으로 할당되게 하려면, 다음 명령 중 하나를 입력하십시오.
       db2 load from datafile1.del of del modified by identityoverride
          replace into table2 
    이 경우, 1과 2행은 거부됩니다. 그 이유는 유틸리티가 사용자 제공 값을 위해 시스템이 생성한 식별 값을 대체하도록 지시했기 때문입니다. 만약 사용자 제공 값이 제시되지 않으면 식별 컬럼이 NULL이 아니기 때문에 행은 거부되어야 합니다.
  5. 식별 관련 파일 유형 수정자를 사용하지 않고 DATAFILE1이 TABLE2로 로드되면, 3과 4행은 자체의 NULL이 아닌 값을 제공하고 식별 컬럼이 GENERATED ALWAYS이기 때문에, 1과 2행은 로드되지만 3과 4행은 거부됩니다.

728x90
728x90

DB2® 데이터베이스 시스템에서는 인스턴스 및 데이터베이스 디렉토리가 최소 수준의 사용 권한을 가지고 있어야 합니다.

주: 인스턴스 및 데이터베이스 디렉토리가 DB2 데이터베이스 관리 프로그램에 의해 작성되면, 권한이 정확하고 변경되지 않아야 합니다.
UNIX 및 Linux 머신에 있는 인스턴스 디렉토리 및 NODE000x/sqldbdir 디렉토리의 최소 권한은 u=rwx 및 go=rx여야 합니다. 여기에 사용된 문자가 의미하는 바는 다음 표와 같습니다.
문자의미
u사용자(소유자)
g그룹
o기타 사용자
r읽기
w쓰기
x실행
예를 들어, /home에 있는 db2inst1 인스턴스에 대한 사용 권한은 다음과 같습니다.
drwxr-xr-x  36 db2inst1  db2grp1         4096 Jun 15 11:13 db2inst1  
데이터베이스가 있는 디렉토리의 경우 NODE000x를 포함한 각 디렉토리 레벨에는 다음과 같은 사용 권한이 필요합니다.
drwxrwxr-x  11 db2inst1  db2grp1         4096 Jun 14 15:53 NODE0000/

예를 들어, 데이터베이스가 /db2/data/db2inst1/db2inst1/NODE0000에 있는 경우 /db2/db2/data/db2/data/db2inst1,/db2/data/db2inst1/db2inst1 및 /db2/data/db2inst1/db2inst1/NODE0000 디렉토리에는 drwxrwxr-x가 필요합니다.

NODE000x 내의 sqldbdir 디렉토리에는 다음과 같이 drwxrwxr-x 사용 권한이 필요합니다.
drwx------   5 db2inst1  db2grp1         256 Jun 14 14:17 SAMPLE/ 
drwxr-x---   7 db2inst1  db2grp1        4096 Jun 14 13:26 SQL00001/ 
drwxrwxr-x   2 db2inst1  db2grp1         256 Jun 14 13:02 sqldbdir/
경고:
파일 보안을 유지하려면 DB2 데이터베이스 관리 프로그램이 DBNAME 디렉토리(예: SAMPLE) 및 SQLxxxx 디렉토리를 작성할 때 지정된 사용 권한을 그대로 유지하십시오.


http://publib.boulder.ibm.com/infocenter/db2luw/v9r7/index.jsp?topic=/com.ibm.db2.luw.admin.sec.doc/doc/c0050516.html

728x90
728x90

버퍼 풀 페이지는 사용 중 또는 사용 중이 아니고 더티 또는 정리입니다.

  • 사용 중인 페이지는 현재 읽거나 갱신 중인 페이지입니다. 페이지를 갱신 중인 경우 갱신자만 액세스할 수 있습니다. 그러나 페이지를 갱신하지 않는 경우 읽는 사용자가 동시에 여러 명일 수 있습니다.
  • 더티 페이지에는 변경되었지만 아직 디스크에 기록되지 않은 데이터가 포함됩니다.
데이터베이스가 종료되거나 페이지가 차지하는 스페이스가 다른 페이지에 필요하거나 예를 들어, 오브젝트 삭제의 일부분으로 버퍼 풀에서 페이지가 명시적으로 제거되기 전까지 페이지는 버퍼 풀에 남아 있습니다. 다음 기준은 다른 페이지에 스페이스가 필요하면 제거되는 페이지를 판별합니다.
  • 얼마나 최근에 페이지가 참조되었습니까?
  • 페이지가 다시 참조될 가능성이 있습니까?
  • 페이지에 어느 데이터 유형이 들어 있습니까?
  • 메모리에서 페이지가 변경되었지만 디스크에 기록되지 않았습니까?

변경된 페이지는 항상 겹쳐쓰기 전에 디스크에 기록됩니다. 디스크에 기록되는 변경된 페이지는 스페이스가 필요하지 않는 한 버퍼 풀에서 자동으로 제거되지 않습니다.

페이지 클리너 에이전트

올바로 조정된 시스템에서 보통 변경된 페이지 또는 더티 페이지를 디스크에 기록하는 페이지 클리너 에이전트입니다. 페이지 클리너 에이전트는 입출력을 백그라운드 프로세스로 수행하고 에이전트가 실제 트랜잭션 작업을 수행할 수 있으므로 응용프로그램을 빠르게 실행할 수 있도록 지원합니다. 페이지 클리너 에이전트는 다른 에이전트의 작업과 협력하지 않으며 필요한 경우에만 작동하므로 비동기 페이지 클리너 또는 비동기 버퍼 기록기라고도 합니다.

갱신에 집중된 워크로드의 성능을 향상시키기 위해 혁신적인 페이지 정리를 사용할 수 있습니다. 이 경우 지정된 시점에 기록되는 더티 페이지를 선택할 때 페이지 클리너를 혁신적으로 사용할 수 있습니다. 이러한 내용은 특히 스냅샷이 비동기 데이터 페이지 또는 인덱스 페이지 쓰기와 관련하여 동기 데이터 페이지 또는 인덱스 페이지 쓰기 수가 있음을 표시하는 경우에 적용됩니다.

그림 1에서는 버퍼 풀 관리 작업을 페이지 클리너 에이전트와 데이터베이스 에이전트 사이에 공유할 수 있는 방식을 보여 줍니다.

그림 1. 비동기 페이지 정리더티 페이지가 디스크에 기록됩니다.
비동기 페이지 정리
프로세스

페이지 정리 및 빠른 복구

데이터베이스 관리 프로그램은 데이터베이스 로그 파일에서 트랜잭션을 재실행하는 것보다 디스크에서 버퍼 풀을 추가로 재빌드할 수 있으므로 디스크에 추가 페이지가 기록된 경우 시스템 파손 후 데이터베이스 복구가 빠릅니다.

복구 중 읽어야 하는 로그의 크기는 로그에 있는 다음 레코드들의 위치마다 다릅니다.
  • 최근에 기록한 로그 레코드
  • 버퍼 풀에서 데이터의 가장 오래된 변경사항에 대해 설명하는 로그 레코드
복구 중 재실행해야 하는 로그의 크기가 다음을 초과하지 않는 방식으로 페이지 클리너는 디스크에 더티 페이지를 기록합니다.
   logfilsiz * softmax / 100 (4-KB페이지 단위)
각 항목에 대한 설명은 다음과 같습니다.
  • logfilsiz는 로그 파일의 크기를 나타냅니다.
  • softmax는 데이터베이스 파손 후 복구할 로그 파일의 퍼센트를 나타냅니다. 예를 들어, softmax의 값이 250인 경우 2.5 로그 파일에는 파손이 발생하면 복구해야 하는 변경사항이 포함됩니다.

복구 중 로그 읽기 시간을 최소한으로 줄이려면 데이터베이스 시스템 모니터를 사용하여 페이지 정리를 수행하는 횟수를 추적하십시오. 데이터베이스의 혁신적 페이지 정리를 사용 가능하게 하지 않은 경우 pool_lsn_gap_clns(트리거된 버퍼 풀 로그 스페이스 클리너) 모니터 요소가 이 정보를 제공합니다. 혁신적 페이지 정리를 사용 가능하게 설정한 경우 이 조건이 발생하지 않으며 pool_lsn_gap_clns의 값은 0입니다.

log_held_by_dirty_pages 모니터 요소를 사용하여 페이지 클리너가 사용자가 설정한 복구 기준에 맞게 충분한 페이지를 정리하지 않는지 판별할 수 있습니다. log_held_by_dirty_pages가 logfilsiz * softmax보다 계속해서 상당히 큰 경우 추가 페이지 클리너가 필요하거나 softmax를 고정해야 합니다.


데이터 페이지의 버퍼 풀 관리

http://publib.boulder.ibm.com/infocenter/db2luw/v9r7/index.jsp?topic=%2Fcom.ibm.db2.luw.admin.perf.doc%2Fdoc%2Fc0005393.html 


softmax - 복구 범위 및 소프트 체크포인트 간격 구성 매개변수

http://publib.boulder.ibm.com/infocenter/db2luw/v9r7/topic/com.ibm.db2.luw.admin.config.doc/doc/r0000242.html


버퍼 풀

http://publib.boulder.ibm.com/infocenter/db2luw/v9r7/index.jsp?topic=%2Fcom.ibm.db2.luw.admin.dbobj.doc%2Fdoc%2Fc0052482.html


로깅 오버헤드를 축소한 DML 성능 향상

http://publib.boulder.ibm.com/infocenter/db2luw/v9r7/topic/com.ibm.db2.luw.admin.perf.doc/doc/c0005425.html


갱신 프로세스

http://publib.boulder.ibm.com/infocenter/db2luw/v8/index.jsp?topic=/com.ibm.db2.udb.doc/admin/c0005425.htm


응급 복구 분석

http://publib.boulder.ibm.com/infocenter/db2luw/v8/index.jsp?topic=/com.ibm.db2.udb.pd.doc/pd/c0020759.htm




728x90
728x90


Question

Why is the DB2 Java daemon (db2jd) not running on my UNIX machine?

Cause

The DB2® Java daemon (db2jd) is not started on UNIX® platforms automatically.

Answer

On UNIX systems, you have to start the JDBC listener manually by running "db2jstrt 6789" (where 6789 is the port that the Java listener will be listening on). If you want to start the listener automatically, you have to put "db2jstrt 6789" in a script file and run this script each time you log in or during system startup. Another option is to modify /etc/inittab to start this listener on reboot.



https://www-304.ibm.com/support/docview.wss?uid=swg21187846

728x90
728x90


Question

What DB2 UDB 9.x command turns auto-commit off or on?

Answer

Method 1:

Using “+c” option turns off auto-commit for the current command ; rollback will undo this uncommitted change

[db2inst1@frodo ~]$ db2 +c "update tec_t_evt_rep set source=‘changeme'"
DB20000I The SQL command completed successfully.
[db2inst1@frodo ~]$ db2 rollback
DB20000I The SQL command completed successfully.
[db2inst1@frodo ~]$ db2 terminate
DB20000I The TERMINATE command completed successfully.


Method 2: 
Example: using DB2OPTIONS env variable with +c (off) or -c (on)

[db2inst1@frodo ~]$ export DB2OPTIONS='+c -a'
[db2inst1@frodo ~]$ db2 list command options
Command Line Processor Option Settings

Backend process wait time (seconds) (DB2BQTIME) = 1
No. of retries to connect to backend (DB2BQTRY) = 60
Request queue wait time (seconds) (DB2RQTIME) = 5
Input queue wait time (seconds) (DB2IQTIME) = 5
Command options (DB2OPTIONS) = +c -a

Option Description Current Setting
------ ---------------------------------------- ---------------
-a Display SQLCA on
-c Auto-Commit OFF


Method 3:
Example: Turning off/on auto-commit for session only

Turning off:
C:\SQLLIB\BIN>db2 update command options using c OFF 

Turning on:
C:\SQLLIB\BIN>db2 update command options using c on 

Note: Method 3 only used for temporary change during interactive mode 
(The db2=> prompt). It affects the current interactive session only. With
c on, other users will see the changes made; with c OFF, other users will
be locked out of seeing the change until the commit is made..

Method 4: Using db2cli.ini configuration file

[mydatabase_alias] 
autocommit=0 

Note:
Env Variable Overrides to db2cli.ini are:
SQL_ATTR_AUTOCOMMIT= 1 or 0 (on or off)


https://www-304.ibm.com/support/docview.wss?uid=swg21297813

728x90

+ Recent posts