且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

ibm db2 net driver sql错误。找不到表名?

更新时间:2023-11-17 12:58:07

乍一看,似乎DB2没有在 webuser 模式下找到该表名,或者当前连接的用户的模式与表的模式不匹配。尝试:

At first glance, it seems that DB2 is not finding that table name under the webuser schema, or the schema of the current connected user does not match the schema for the table. Try:

select * from webuser.table

如果失败,那么它可能不存在于 webuser 模式之下,所以尝试找出它存在的模式。

If that fails, then it probably does not exist under the webuser schema, so try to find out what schema it does exist under.

您可以经常找到 sql错误代码 IBM DB2信息中心或DB2 UDB命令行,如下所示:

You can often find information for sql error codes in the IBM DB2 infocenter or on the DB2 UDB command line like so:

db2 ? SQL0100

您可以通过以下方式查找任何错误:

You can look up any error this way:

db2 ? SQLnnnnn 

其中 nnnnn 是错误代码。

您还可以通过在google上搜索来自db2的sql错误代码的信息,而不必包含 - 从搜索结果中删除前面带有破折号的术语。所以,搜索 sql code 204 而不是 sql code -204

You can also often find information on sql error code from db2 by searching on google without including the - since google removes the term with a dash in front from the search results. So, search for sql code 204 and not sql code -204 .

通常可以在 sysibm.tables syscat下找到所有表的列表.tables 根据您运行的系统类型(z / OS或UDB),还取决于db2管理员是否限制对这些目录表的访问。

You can usually find a list of all the tables under sysibm.tables or syscat.tables depending on what type of system (z/OS or UDB) you are running on, and also depending on if the db2 administrator has restricted access to those catalog tables.

如果您正在使用UDB实例,请尝试:

If you are running against a UDB instance, try:

select tabschema, tabname from syscat.tables

我当然假设你不希望该表被命名为$ code>表。我会认为这是db2或SQL-92标准下的限制字。

I'm assuming of course that you are not expecting the table to be named table. I would think that is a restricted word under db2 or the SQL-92 standard.

如果您碰巧正在运行运行该查询的存储过程,那么您可能不会看到查询中的真实错误。存储过程通常返回与存储过程中的查询不同的错误代码,除非它们被编程为从查询本身捕获并返回sqlcode和sqlstate。

If you happen to be running a stored procedure that runs that query, then you may not be seeing the true error from the query. Stored procedures often return a different error code than a query inside the stored procedure would, unless they are programmed to catch and return the sqlcode and sqlstate from the query itself.

另外,我看到你正在获得一个-727的sqlcode,一个消息代码为2.它的文档说:

Additionally, I see that you are getting a sqlcode of -727, with a message code of 2. The documentation for that 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 . 

其中action-type为2:隐式准备缓存的动态SQL语句

where the action-type is 2: implicit prepare of a cached dynamic SQL statement

此错误信息对于数据库管理员来说不那么直接和更多的调整。它可能最终有用,但我会先尝试其他建议。这可能意味着某些包未绑定到数据库(如您的网络驱动程序),或数据库中的某些权限不正确或修复包未正确应用,并且缺少数据库过程。但是,这也可能是由-204引起的,只是后来的错误。

This error information is less straightforward and more tuned for a Database Administrator. It may end up being useful but I would try the other suggestions first. It may mean that certain packages are not bound to the database (like the ones for your net driver) or that certain permissions in the database are not correct or a fixpack was not applied correctly and there are missing database procedures. However, it could also be caused by the -204 and just be a subsequent error.