delete emp table data using ssis package - postgresql

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

Related

SQLCODE=-104, SQLSTATE=42601, SQLERRMC=table;reorg ;JOIN <joined_table>

when running this query on db2 on DBeaver :
reorg table departments
i got this error (just on external channel):
DB2 SQL Error: SQLCODE=-104, SQLSTATE=42601, SQLERRMC=table;reorg ;JOIN <joined_table>, DRIVER=4.19.49
what does this query mean?
how can I fix the error?
appricicate any help.
Try call sysproc.admin_cmd('reorg table db2inst1.departments')
as you are using DBeaver which is a jdbc application.
If you do not qualify the table name (for example, with db2inst1) then Db2 will assume that the qualifier (schema name) is the same as the userid name you used when connecting to the database.
DBeaver runs SQL statements, but it cannot directly run commands of Db2 - instead, any jdbc app can run Db2-commands indirectly via a stored-procedure that you CALL. The CALL is an SQL statement.
The reorg table is a command, it is not an SQL statement, so it needs to be run via the admin_cmd stored-procedure, or it can be run from the operating system command line (or db2 clp) after connecting.
So if you have db2cmd.exe on MS-Windows, or bash on linux/unix, you can connect to the database, and run commands via the db2 command.

getting error when delete and the table does not have data

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;

Tomcat 8 Db2 Error: com.ibm.db2.jcc.b.eo: DB2 SQL Error: SQLCODE=-551, SQLSTATE=42501, SQLERRMC=M25044

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.

Encountering SQL30000N Execution failed because of a Distributed Protocol Error

I have Successfully cataloged remote iseries OS/400 DB2 on db2 9.1 ESE.
I am able to connect to database successfully as well but when i run below query or any other query i get following error:-
Query:
select 1 from sysibm.tables
Error:
Encountering SQL30000N Execution failed because of a Distributed Protocol Error that will
not affect the successful execution of subsequent commands or SQL statements:
Reason Code "0x1254"("0200"). SQLSTATE=58008
Pls let me know where i am making mistake..?

Explain for DB2 in IBM Data Server Manager fails

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.