Error ibm db2 net driver sql. Can't find the table name?

from this query: select * from table

The following error message appears:

Error: DB2 SQL error: SQLCODE = -204, SQLSTATE = 42704, SQLERRMC = webuser.table, DRIVER = 4.8.87 SQLState: 42704 ErrorCode: -204 Error: DB2 SQL error: SQLCODE = -727, SQLSTATE = 56098, SQLERRMC = 2; -204; 42,704; webuser.table, DRIVER = 4.8.87 SQLState: 56098 ErrorCode: -727

Any suggestions on how to investigate the problem are greatly appreciated.

+6
source share
1 answer

At first glance, it seems that DB2 does not find this table name in the webuser , or the schema of the currently connected user does not match the schema for the table. Try:

 select * from webuser.table 

If this fails, then it probably does not exist in the webuser , so try to figure out which schema exists.

Often you can find information for sql error codes in the IBM DB2 infocenter or on the DB2 UDB command line as follows:

 db2 ? SQL0100 

You can find any error as follows:

 db2 ? SQLnnnnn 

where nnnnn is the error code.

You can also find information about sql error code from db2 by doing a google search without including - , since google removes this term with a dash in front of the search results. So, find sql code 204 , not sql code -204 .

You can usually find a list of all the tables in sysibm.tables or syscat.tables depending on what type of system (z / OS or UDB) you are using, and also depending on whether the db2 administrator had limited access to these directory tables .

If you are working with an UDB instance, try:

 select tabschema, tabname from syscat.tables 

I assume, of course, that you do not expect the table to be called table . I think this is a limited word under db2 or the SQL-92 standard.

If you are executing a stored procedure that executes this request, you may not see the true error from the request. Stored procedures often return a different error code than the request inside the stored procedure, unless they are programmed to capture and return sqlcode and sqlstate from the request itself.

Also, I see that you are getting sql -727 code with message code 2. The documentation for this says:

 An error occurred during implicit system action type action-type . Information returned for the error includes SQLCODE sqlcode , SQLSTATE sqlstate and message tokens token-list . 

where action type is 2: implicit collection of cached dynamic SQL statement

This error information is less simple and more configurable for the database administrator. This may be useful, but first I will try other suggestions. This may mean that certain packages are not bound to the database (for example, for your network driver) or that certain permissions in the database are incorrect or the patch is not applied correctly and there are no database procedures. However, this can also be caused by -204 and just be a subsequent error.

+5
source

Source: https://habr.com/ru/post/895816/


All Articles