I am using the SQL Editor in IBM Data Server Manager to execute queries against DB2. The query in question works fine. However, when I click "Explain" to generate the access plan I get
"Access Plan Graph Cannot Be Generated"
and the diagnostic text is
The SQL statement failed. Explanation: The SQL statement resulted in
an error with SQLCODE: -204 and SQLSTATE: 42704. User response: The
DB2 documentation contains more information about the SQLCODE and how
to resolve the error. "DB2ADMIN.TABLENAME" is an undefined name..
SQLCODE=-204, SQLSTATE=42704, DRIVER=3.66.46
The query is something like
select col1, col2 from tablename where pred=value
Why is it failing? What needs to be changed?
The error code -204 hints at the tablename not being know ("undefined name"). It seems that even though a query runs successfully without using a fully qualified name (schemaname.tablename), the explain functionality in IBM Data Server Manager needs the full name to work.
Changing the query to "select col1, col2 from schemaname.tablename where pred=value" caused the explain to succeed and it shows a nice graph of the access plan.
Related
Hi I have one doubt in ssis
I want delete the data in the target server(postgres) tables data using ssis package.
database: postgres server
Table: emp
in execute sql task, script is: delete from emp and connection used odbc
When I run the executesql task in ssis package
if emp table have data then its working fine and I am getting the error when emp table does not have data.
[Execute SQL Task] Error: Executing the query "delete from emp
usin..." failed with the following error: "Error HRESULT E_FAIL has been returned from a call to a COM component.". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly.
suppose if i run same query in pgadmin tool that time it is not getting any error even though emp table does not have data.
could you please tell me how to avoid this issue in ssis package
In Execute SQL Task component , you should type your delete script in transaction block like below ;
BEGIN;
DELETE FROM yourtable;
COMMIT;
I want delete the data in the target server(postgres) tables data using ssis package.
database : postgres server
Table : emp
in execute sql task :scriptis: delete from emp and connection used odbc
when i run the executesql task in ssis package
if emp table have data then its working fine and i am getting the error when emp table donot have data.
[Execute SQL Task] Error: Executing the query "delete from emp
usin..." failed with the following error: "Error HRESULT E_FAIL has been returned from a call to a COM component.". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly.
suppose if i run same query in pgadmin tool that time it is not getting any error even though emp table donot have data.
how to avoid this issue in ssis package?
If I understand correctly, The DELETE statement contains the connection. I guess you have passed the ODBC connection manager to the Execute SQL Task properties - Connection Type and Connection. Then your SQL script could be just:
DELETE FROM emp;
SSIS - Execute SQL Task Editor
After about a year and half, I am finally able to connect to the DB2 database we have through dBeaver. The connection is successful as a LUW (Our db2 is z/os). I was able to get the drivers required after installing IBM Data Studio.
Once I am connected, I go down the schema, get to Tables, and on clicking that, I get the below error.
SQL Error [42704]: SYSCAT.SCHEMATA IS AN UNDEFINED NAME. SQLCODE=-204, SQLSTATE=42704, DRIVER=3.69.56
SYSCAT.SCHEMATA IS AN UNDEFINED NAME. SQLCODE=-204, SQLSTATE=42704, DRIVER=3.69.56
THE DESCRIBE STATEMENT DOES NOT SPECIFY A PREPARED STATEMENT. SQLCODE=-516, SQLSTATE=26501, DRIVER=3.69.56
THE CURSOR SQL_CURLH200C1 IS NOT IN A PREPARED STATE. SQLCODE=-514, SQLSTATE=26501, DRIVER=3.69.56
SQL Error [42704]: SYSCAT.SCHEMATA IS AN UNDEFINED NAME. SQLCODE=-204, SQLSTATE=42704, DRIVER=3.69.56
However, if ignore the error and go to New SQL query and write a simple
Select * from schema.table
it works fine and get the results I want.
Considering the time i have spent to get till here, this is sufficient, but to deploy as a solution in my department, I need to be able to look at a Table List (schema).
Any help would be awesome.
EDIT1: What the issue is here, is that there is no SCHEMA with the name SYSCAT and no table named SCHEMATA.
The z/OS Db2 catalog has different names than the ones used on Db2 on distributed (Linux Unix Windows aka LUW). Here is a list of objects on Db2 z/OS that you can review.
It looks like you are using dBeaver to navigate through a UI the objects on Db2 for z/OS. You will need to ensure you have a db2 jcc driver that is for z/OS Db2. It looks like you may be using one from LUW as the SYSCAT.SCHEMATA is an LUW object, not a z/OS object.
Your other query works because you are specifying a known table name. Other queries should be fine. The issue is the interface in dbeaver is looking at Db2 system objects for LUW and not z/OS. This will continue until you are able to resolve the driver issue.
The IBM Data Server Drivers also require server sided set-up. Please see this information https://www.ibm.com/support/knowledgecenter/SSEPEK_12.0.0/java/src/tpc/imjcc_jccenablespsandtables.html
In DBeaver, when you create a connection choose the "DB2 z/OS driver" option under the Db2 drop down, when connecting to DB2 for z/OS
BTW DBeaver can shell share with Data Studio, so you can (if you wish) use both products in one install. No guarantees that they share happily in all cases, but it appears to work reasonably well.
I have been trying to resolve this error which was working for so long
out of nowhere we have started facing this issue.
My application, which is a plain Java web application (Jsp/Servlets and couple of utilities and control classes) running on Tomcat 8
One of the functionality is, the user keys in an id which is a key for a DB query to fire up the Database and get the results
In doing so I get this below error, which is more or less a symptom of user not having the privilege to execute the query on the
Db2 Database table.
When I am trying out the same query from any kind of Db2 Client tools or SQL prompt, I don't get this error at all:
" com.ibm.db2.jcc.b.eo: DB2 SQL Error: SQLCODE=-551, SQLSTATE=42501, SQLERRMC=M25044"
SQLCODE -551 means that the User executing the Query does not have the right Privilege. So find out which User is running the Query and grant the Privilege to that User. May be from other SQL Clients you use a different User.
I am connecting to my PostgreSQL DB on AWS RDS through SQL workbench. i have created a new table. it created successfully. table name is like public.xyz.
Now when i am trying to access the select query on 'public.xyz' i am getting error like
'Relation public.xyz does not exist'.
i have checked that my show_path contains %user,public. no case issue.
i have tried select query like select * from public.xyz and select * from xyz etc.. all have same issue
please suggest.
it seems to be a problem with SQL workbench. when i tried to create table using psql client on a linux machine, it worked properly. now i am able to run the same select query which was failing earlier. don't know inner details, but it seems to be an issue with SQL workbench.