Common Errors and cracking solutions for DB2 Databases

Source: Internet
Author: User
Tags db2 sql error sql error table definition

The following articles mainly describe Common Errors of DB2 databases and the correct solutions. If you are curious about Common Errors of DB2 databases and the correct solutions, the following articles will unveil its mysteries. I hope you will gain some benefits after browsing.

Document category: Database

1. Error 42704 is reported when you create a DB2 database. For example:

SQL code

 
 
  1. =>create database test   
  2. =>SQL0204N "SYSTEM_1386_US" is an undefined name. SQLSTATE=42704 
  3. =>create database test 
  4. =>SQL0204N "SYSTEM_1386_US" is an undefined name. SQLSTATE=42704 

Solution: SQL code

 
 
  1. =>create database test using codeset gbk territory cn 
  2. =>create database test using codeset gbk territory cn  

2. A 57017 error is reported during data connection. For example:

SQL code

 
 
  1. =>connect to test user test using test   
  2. =>SQL0332N Character conversion from the source code page "1386" to the target code page "819" is not supported. SQLSTATE=57017 
  3. =>connect to test user test using test 
  4. =>SQL0332N Character conversion from the source code page "1386" to the target code page "819" is not supported. SQLSTATE=57017 

Solution:

SQL code

 
 
  1. =>db2set db2codepage=1386 
  2. =>db2set db2codepage=1386 

3. When operating the DB2 database, the system reports error 55039. For example:

SQL code

 
 
  1. =>db2 drop table t_base_acc_manageacc   
  2. =>SQL0290N Table space access is not allowed. SQLSTATE=55039   
  3. =>db2 list tablespaces show detail   
  4. Tablespace ID = 2   
  5. Name = USERSPACE1   
  6. Type = System managed space   
  7. Contents = Any data   
  8. State = 0x0020   
  9. Detailed explanation:   
  10. Backup pending 
  11. =>db2 drop table t_base_acc_manageacc 
  12. =>SQL0290N Table space access is not allowed. SQLSTATE=55039 
  13. =>db2 list tablespaces show detail  
  14. Tablespace ID = 2 
  15. Name = USERSPACE1 
  16. Type = System managed space  
  17. Contents = Any data  
  18. State = 0x0020 
  19. Detailed explanation: 

Backup pending reason: the database has been loaded or modified to restart the database.

Solution:

SQL code

Back up a DB2 database

=> Db2 backup db

Back up database

=> Db2 backup db

4. When backing up the database, the system reports the 57019 error. For example:

SQL code

 
 
  1. =>db2 backup database dbname to /xx/xx compress   
  2. =>SQL1035N The database is currently in use. SQLSTATE=57019 
  3. =>db2 backup database dbname to /xx/xx compress  

> SQL1035N The database is currently in use. SQLSTATE = 57019 solution:

SQL code

 
 
  1. =>db2stop force   
  2. =>db2start 
  3. =>db2stop force 
  4. =>db2start 

5. When creating a tablespace, the system reports the error 54047. For example:

SQL code

 
 
  1. =>create regular tablespace space1 pagesize 4 k managed by database using (device '/dev/dd' 25000000) prefetchsize automatic bufferpool bp1   
  2. =>SQL1139N The total size of the table space is too big. SQLSTATE=54047 
  3. =>create regular tablespace space1 pagesize 4 k managed by database using (device '/dev/dd' 25000000) prefetchsize automatic bufferpool bp1  

=> SQL1139N The total size of the table space is too big. SQLSTATE = 54047 solution: reduce The tablespace size or change regular64G to large.

6. If the DB2 database fails to be backed up, it indicates that the memory is insufficient and dbheap is increased. SQL2009C. There is not enough memory to run this utility.

Cause: DB2 UTIL_HEAP_SZ is not set high enough for backup utilities.

Solution: db2 update db cfg for dbname using UTIL_HEAP_SZ the memory used for the specific digital db2 backup is UTIL_HEAP_SZ. Use the preceding command to adjust the memory ).

7. When you use JDBC to insert data into a table in batches. Error 23502 is reported. For example:

SQL code

 
 
  1. Error for batch element #0: DB2 SQL error: SQLCODE: -407, SQLSTATE: 23502, SQLERRMC: TBSPACEID=2, TABLEID=15, COLNO=2 

Error for batch element #0: DB2 SQL error: SQLCODE:-407, SQLSTATE: 23502, SQLERRMC: TBSPACEID = 2, TABLEID = 15, COLNO = 2 cause: insert null values for fields with non-null constraints in the table.

Solution: View table definitions, remove non-null constraints, or add non-null values.

8. When you use JDBC to insert data into a table in batches. Error 22001 is reported. For example:

SQL code

 
 
  1. DB2 SQL Error: SQLCODE=-302, SQLSTATE=22001, SQLERRMC=null 
  2. DB2 SQL Error: SQLCODE=-302, SQLSTATE=22001, SQLERRMC=null 

Cause: if the length of a field in the table is insufficient, string truncation occurs.

Solution: view the table definition and increase the field length.

9. When you use JDBC to insert data into a table in batches. The error "-4474" is reported. For example:

SQL code

Invalid conversion: cannot be converted from "java. lang. String" to "byte []" ERRORCODE =-4474, SQLSTATE = null

Invalid conversion: cannot begin with "java. lang. string "to" byte [] "ERRORCODE =-4474, SQLSTATE = null reason: a field in the table is defined as 'id CHAR (16) for bit data not null', which is converted to uniqueidentifier when MTK is used to migrate DATA from ms SQL to DB2 database ).

Solution: recreate the table and change the field attribute to the VARCHAR type.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.