DB2中遇到的错误及修改方法

错误1
com.ibm.db2.jcc.b.nm: DB2 SQL Error: SQLCODE=-204, SQLSTATE=42704, SQLERRMC=DB2ADMIN.SOFT_VERSION, DRIVER=3.50.152

原因是:表SOFT_VERSION不是直接在DB2ADMIN下面,应在DB2命令编辑器查看SOFT_VERSION在那个目录下面。


错误2
com.ibm.db2.jcc.c.DisconnectException: encoding not supported!!
at com.ibm.db2.jcc.a.bb.b(bb.java:1610)
at com.ibm.db2.jcc.a.cb.ac(cb.java:4454)
at com.ibm.db2.jcc.a.cb.a(cb.java:4392)
at com.ibm.db2.jcc.a.cb.c(cb.java:4314)
at com.ibm.db2.jcc.a.cb.b(cb.java:4247)
at com.ibm.db2.jcc.a.cb.a(cb.java:4225)
at com.ibm.db2.jcc.a.cb.l(cb.java:373)
at com.ibm.db2.jcc.a.cb.d(cb.java:145)
at com.ibm.db2.jcc.a.b.Sb(b.java:1274)
at com.ibm.db2.jcc.a.b.a(b.java:1166)
at com.ibm.db2.jcc.a.b.q(b.java:934)
at com.ibm.db2.jcc.a.b.a(b.java:702)
at com.ibm.db2.jcc.a.b.<init>(b.java:305)
at com.ibm.db2.jcc.DB2Driver.connect(DB2Driver.java:162)
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at com.huawei.client.db.DBConnection.init(DBConnection.java:52)
at com.huawei.client.db.DBConnection.main(DBConnection.java:81)

原因是:架包出了问题,把本地的架包放进去就OK了。


错误3
导入表时,报以下异常,表结构已建立,但是数据没有导进表中。
db2inst1@linux:~/wsx> db2 "import from TBL_OPTION.ixf of ixf create into test1"
SQL3150N  The H record in the PC/IXF file has product "DB2    02.00", date
"20100826", and time "181146".

SQL3153N  The T record in the PC/IXF file has name "TBL_OPTION.ixf", qualifier
"", and source "            ".

SQL3109N  The utility is beginning to load data from file "TBL_OPTION.ixf".

SQL3550W  The field value in row "1" and column "1" is not NULL, but the
target column has been defined as GENERATED ALWAYS.

SQL3550W  The field value in row "2" and column "1" is not NULL, but the
target column has been defined as GENERATED ALWAYS.

SQL3550W  The field value in row "3" and column "1" is not NULL, but the
target column has been defined as GENERATED ALWAYS.

SQL3550W  The field value in row "4" and column "1" is not NULL, but the
target column has been defined as GENERATED ALWAYS.

SQL3550W  The field value in row "5" and column "1" is not NULL, but the
target column has been defined as GENERATED ALWAYS.

SQL3550W  The field value in row "6" and column "1" is not NULL, but the
target column has been defined as GENERATED ALWAYS.

SQL3550W  The field value in row "7" and column "1" is not NULL, but the
target column has been defined as GENERATED ALWAYS.

SQL3550W  The field value in row "8" and column "1" is not NULL, but the
target column has been defined as GENERATED ALWAYS.

SQL3550W  The field value in row "9" and column "1" is not NULL, but the
target column has been defined as GENERATED ALWAYS.

SQL3550W  The field value in row "10" and column "1" is not NULL, but the
target column has been defined as GENERATED ALWAYS.

SQL3550W  The field value in row "11" and column "1" is not NULL, but the
target column has been defined as GENERATED ALWAYS.

SQL3550W  The field value in row "12" and column "1" is not NULL, but the
target column has been defined as GENERATED ALWAYS.

SQL3550W  The field value in row "13" and column "1" is not NULL, but the
target column has been defined as GENERATED ALWAYS.

SQL3550W  The field value in row "14" and column "1" is not NULL, but the
target column has been defined as GENERATED ALWAYS.

SQL3110N  The utility has completed processing.  "14" rows were read from the
input file.

SQL3221W  ...Begin COMMIT WORK. Input Record Count = "14".

SQL3222W  ...COMMIT of any database changes was successful.

SQL3149N  "14" rows were processed from the input file.  "0" rows were
successfully inserted into the table.  "14" rows were rejected.


Number of rows read         = 14
Number of rows skipped      = 0
Number of rows inserted     = 0
Number of rows updated      = 0
Number of rows rejected     = 14
Number of rows committed    = 14

原因是由于表中的ID为自增序列,在导入表时,增加一个参数即可。如下:
  load  from 文件名.ixf  of ixf   modified  by  identityoverride insert into 表名
  load  from 文件名.ixf  of ixf   modified  by  identityignore insert into 表名



错误4
查询表是报如下错误:
SQL0668N  Operation not allowed for reason code "3" on table
"DB2INST1.TBL_PIM_NODE_SRC_USER_STATE".  SQLSTATE=57016

原因是LOAD的时候表暂挂了(loading pending),执行如下命令可解:
db2  "load  from   .*.ixf    of    ixf     terminate   into    表名“


错误5
往表里导入日志时报,如下错误:
SQL3306N  An SQL error "-964" occurred while inserting a row into the table.

SQL0964C  The transaction log for the database is full.  SQLSTATE=57011

SQL3110N  The utility has completed processing.  "17503423" rows were read
from the input file.

原因:事务日志已满。


错误6
DB2 SQL error: SQLCODE: -911, SQLSTATE: 40001
原因:死锁或者超时了,自动回滚了
解决方法:
db2  "force  applications  all"
db2  terminate(此条命令可多执行几次)

你可能感兴趣的:(java,sql,linux,db2,IBM)