IBM Support

db2rbind may cause applications return SQL error -518 or -514

Technical Blog Post


Abstract

db2rbind may cause applications return SQL error -518 or -514

Body

It is recommended to run db2rbind during maintenance time when there is no application connecting to the database.

In case there are applications running while db2rbind is running, you may see the following symptom depending on the timing:

- db2rbind returns lock timeout and fails to bind some packages

- applications may return SQL error -518 (SQL0518N)

- applications may return SQL error -514 (SQL0514N)

 

The following is an example of application receives error SQLCODE=-518:

com.ibm.db2.jcc.am.SqlException: DB2 SQL Error: SQLCODE=-518, SQLSTATE=07003, SQLERRMC=null, DRIVER=3.69.71
        at com.ibm.db2.jcc.am.gd.a(gd.java:752)
        at com.ibm.db2.jcc.am.gd.a(gd.java:66)
        at com.ibm.db2.jcc.am.gd.a(gd.java:135)
        at com.ibm.db2.jcc.am.bp.b(bp.java:2447)
        at com.ibm.db2.jcc.am.bp.c(bp.java:2430)
        at com.ibm.db2.jcc.t4.bb.l(bb.java:406)
        at com.ibm.db2.jcc.t4.bb.a(bb.java:62)
        at com.ibm.db2.jcc.t4.p.a(p.java:50)
        at com.ibm.db2.jcc.t4.wb.b(wb.java:220)
        at com.ibm.db2.jcc.am.cp.rc(cp.java:3457)
        at com.ibm.db2.jcc.am.cp.b(cp.java:4444)
        at com.ibm.db2.jcc.am.cp.jc(cp.java:795)
        at com.ibm.db2.jcc.am.cp.executeUpdate(cp.java:773)
        at Test.main(Test.java:85)

 

Db2 returns SQLCODE -518 as db2rbind has rebound the packages, which corresponds with 3rd condition in the explanation of

the SQL code.

 

SQL0518N   The statement named in the EXECUTE statement is not in a prepared state or is a SELECT or VALUES statement.

Explanation

The application program tried to EXECUTE a statement that

  1. was never prepared,
  2. is a SELECT or VALUES statement,
  3. was made not valid by either an explicit or implicit rebind of the package,

[{"Business Unit":{"code":"BU029","label":"Data and AI"}, "Product":{"code":"SSEPGG","label":"DB2 for Linux, UNIX and Windows"},"Component":"","Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"","Edition":""}]

UID

ibm13285777