I am new to IIB, trying to connect to Oracle DB using ESQL. Trying to pass a local param to where clause in simple SELECT statement. Getting below error while executing it. Can anyone help me out
ESQL:
BROKER SCHEMA com.project
CREATE COMPUTE MODULE MainFlow_Compute
CREATE FUNCTION Main() RETURNS BOOLEAN
BEGIN
DECLARE var REFERENCE TO Environment.Variables;
DECLARE username CHAR;
SET username = InputRoot.JSON.Data.userid;
--SET OutputRoot.XML.Invoice[] = SELECT E.EMPLOYEE_ID,E.FIRST_NAME FROM Database.HR.EMPLOYEES AS E WHERE E.EMPLOYEE_ID=username;
SET OutputRoot.XML.Invoice[] = PASSTHRU('SELECT E.EMPLOYEE_ID,E.FIRST_NAME FROM Database.HR.EMPLOYEES AS E WHERE E.EMPLOYEE_ID=?' VALUES(username));
SET OutputRoot.JSON.Data.user_id=username;
--SET OutputRoot.JSON.Data.user_name=var.profile.FIRST_NAME;
RETURN TRUE;
END;
END MODULE;
Log:
Error: BIP3113E: Exception detected in message flow com.project.MainFlow
http://localhost:7800/users/getUserDetails
Exception. BIP2230E: Error detected whilst processing a message in node 'com.project.MainFlow.Compute'. : F:\build\slot2\S1000_P\src\DataFlowEngine\SQLNodeLibrary\ImbComputeNode.cpp: 515: ImbComputeNode::evaluate: ComIbmComputeNode: com/project/MainFlow#FCMComposite_1_4
BIP2488E: ('com.project.MainFlow_Compute.Main', '14.4') Error detected while executing the SQL statement ''SET OutputRoot.XML.Invoice[] = DEFAULTPASSTHRU('SELECT E.EMPLOYEE_ID,E.FIRST_NAME FROM Database.HR.EMPLOYEES AS E WHERE E.EMPLOYEE_ID=?', username);''. : F:\build\slot2\S1000_P\src\DataFlowEngine\ImbRdl\ImbRdlStatementGroup.cpp: 767: SqlStatementGroup::execute: :
BIP2321E: Database error: ODBC return code '-1' using ODBC driver manager ''odbc32.dll''. : F:\build\slot2\S1000_P\src\DataFlowEngine\MessageServices\ImbOdbc.cpp: 3814: ImbOdbcStatement::checkRcInner: :
BIP2322E: Database error: SQL State ''IM001''; Native Error Code '0'; Error Text ''[Microsoft][ODBC Driver Manager] Driver does not support this function''. : F:\build\slot2\S1000_P\src\DataFlowEngine\MessageServices\ImbOdbc.cpp: 4035: ImbOdbcStatement::checkRcInner: :
Note: I have referred to below link already
IIB: Passing local variable to ESQL select statement
Related
When executing below code in phpMyAdmin:
use db;
DELIMITER $$
DROP PROCEDURE IF EXISTS McaTest3$$
CREATE PROCEDURE McaTest3()
BEGIN
SELECT
cl.*
FROM `condition_library` cl
LEFT JOIN condition_custom cc on cl.condition_library_id = cc.condition_library_id
and cc.active = 1
AND (cc.permit_application_id = 20231 OR cc.permit_id = NULL)
WHERE FIND_IN_SET(cl.`condition_library_id`, '13070')
AND cl.active = 1
and cc.condition_library_id IS NULL;
END$$
DELIMITER ;
call McaTest3();
Getting error:
Error
Static analysis:
1 errors were found during analysis.
Missing expression. (near "ON" at position 25)
SQL query: Edit Edit
SET FOREIGN_KEY_CHECKS = ON;
MySQL said: Documentation
#2014 - Commands out of sync; you can't run this command now
This happens when there is no record found in the table which is at LEFT JOIN.
When the same is ran in MySQL Workbench: NO ERROR and return empty dataset.
Same procedure when executed from Application (Appian) is failing as well… Any clues?
Another question on Stackoverflow answered my issue:
link: MySQL error #2014 - Commands out of sync; you can't run this command now
I tried :
code :
import cx_Oracle
conn = cx_Oracle.connect('xyz/xyz#xyz:1521/orcl')
cur = conn.cursor()
query = 'EXEC dbms_stats.init_package\(\)'
cur.execute(query)
also
query = 'EXEC dbms_stats.init_package()'
cur.execute(query)
for both try I get following error:
Error: cx_Oracle.DatabaseError: ORA-00900: invalid SQL statement
can you please tell the correct way to run this SQL command
EXEC is an sqlplus command, use BEGIN..END instead
proc='''BEGIN
dbms_stats.init_package();
END;'''
cur.execute(proc);
You can call a stored procedure with callproc.
cur.callproc("DBMS_STATS.INIT_PACKAGE")
Details are here
I am using IIB v9.0.0 on Windows, using Oracle database as source application. While running the interface, I'm getting following below issue, when execute prepared SQL query:
SELECT HDR.SHIPMENT, HDR.EST_ARR_DATE, HDR.TO_LOC, HDR.TO_LOC_TYPE,
HDR.SHIP_DATE, HDR.FROM_LOC, HDR.FROM_LOC_TYPE, HDR.COURIER,
HDR.EXT_REF_NO_OUT, HDR.FR_INSPC_FLG, HDR.FR_TRNSMT_NUM,
HDR.FR_CRRR_SUB_NUM, DTL.SEQ_NO, DTL.ITEM, DTL.QTY_EXPECTED, DTL.DISTRO_NO ,DTL.TSF_TYPE
FROM XXIF_ARV_SCH_HDR_IIB_S HDR , XXIF_ARV_SCH_DTL_IIB_S DTL
WHERE HDR.FR_BIH_STATUS = ? AND DTL.FR_BIH_STATUS = ? AND DTL.SHIPMENT =
HDR.SHIPMENT AND HDR.TO_LOC = ?
I have configured ODBC connectivity and run the command to save credentials
mqsisetdbparms DevNode -n odbc::DSN_ORACLE -u XXIF_IIB -p XXIF_IIB
ExceptionList:
RecoverableException
File:CHARACTER:F:\build\slot1\S900_P\src\DataFlowEngine\ImbRdl\ImbRdlStatementGroup.cpp
Line:INTEGER:650
Function:CHARACTER:SqlStatementGroup::execute
Type:CHARACTER:ImbESQLManager
Name:CHARACTER:ImbESQLManager
Label:CHARACTER:ImbESQLManager
Catalog:CHARACTER:BIPmsgs
Severity:INTEGER:3
Number:INTEGER:2488
Text:CHARACTER:Error detected, rethrowing
Insert
Type:INTEGER:5
Text:CHARACTER:XXIF_DBService.XXIF_ARV_SCH_DTL_IIB_S_OPS_GROUP.retrieveXxifASNDetails
Insert
Type:INTEGER:5
Text:CHARACTER:3.2
Insert
Type:INTEGER:5
Text:CHARACTER:SET dbResultSetRef.row[ ] = SPECIFICPASSTHRU('SELECT HDR.SHIPMENT, HDR.EST_ARR_DATE, HDR.TO_LOC, HDR.TO_LOC_TYPE, HDR.SHIP_DATE, HDR.FROM_LOC, HDR.FROM_LOC_TYPE, HDR.COURIER, HDR.EXT_REF_NO_OUT, HDR.FR_INSPC_FLG, HDR.FR_TRNSMT_NUM, HDR.FR_CRRR_SUB_NUM, DTL.SEQ_NO, DTL.ITEM, DTL.QTY_EXPECTED, DTL.DISTRO_NO , DTL.TSF_TYPE FROM XXIF_ARV_SCH_HDR_IIB_S HDR , XXIF_ARV_SCH_DTL_IIB_S DTL WHERE HDR.FR_BIH_STATUS = ? AND DTL.FR_BIH_STATUS = ? AND DTL.SHIPMENT = HDR.SHIPMENT AND HDR.TO_LOC = ?', Database.DSN_ORACLE, fr_bih_status, fr_bih_status, toloc);
DatabaseException
File:CHARACTER:F:\build\slot1\S900_P\src\DataFlowEngine\MessageServices\ImbOdbc.cpp
Line:INTEGER:3246
Function:CHARACTER:ImbOdbcStatement::checkRcInner
Type:CHARACTER:
Name:CHARACTER:
Label:CHARACTER:
Catalog:CHARACTER:BIPmsgs
Severity:INTEGER:3
Number:INTEGER:2321
Text:CHARACTER:Root SQL exception
Insert
Type:INTEGER:2
Text:CHARACTER:-1
Insert
Type:INTEGER:14
Text:CHARACTER:odbc32.dll
DatabaseException
File:CHARACTER:F:\build\slot1\S900_P\src\DataFlowEngine\MessageServices\ImbOdbc.cpp
Line:INTEGER:3424
Function:CHARACTER:ImbOdbcStatement::checkRcInner
Type:CHARACTER:
Name:CHARACTER:
Label:CHARACTER:
Catalog:CHARACTER:BIPmsgs
Severity:INTEGER:3
Number:INTEGER:2322
Text:CHARACTER:Child SQL exception
Insert
Type:INTEGER:5
Text:CHARACTER:IM001
Insert
Type:INTEGER:2
Text:CHARACTER:0
Insert
Type:INTEGER:5
Text:CHARACTER:[Microsoft][ODBC Driver Manager] Driver does not support this function
Anyone knows the issue, please check.
Check the options that can be configured in ODBC connection, usually you must enable some options to run the sentences and the execution of procedures and functions properly.
In Windows you need to enable checkbox "Enable Nchar support" on your user DSN.
I try to add before migration and after migration scripts as callbacks to flyway for compiling my views, procedures, functions etc.
Is there a possibility to stop it before a migration process or have a rollback when before or after scripts fail (or rather return a warning)?
Cause the only thing I see right now is I receive warnings like this
[WARNING] DB: Warning: execution completed with warning (SQL State: 99999 - Error Code: 17110)
and it goes on, without stopping.
I thought about FlywayCallback interface and it's implementation but I'm not entirely sure how it should be done with compiling.
I'm using Spring Boot 1.2.5 with the newest Flyway.
I have also same error. SQL State: 99999 - Error Code: 17110. i found this solution.
check which version under this warning and that version under sql script check have Trigger or any procedure which not closed properly.
close trigger or any procedure if oracle DB / end of trigger.
ex:
CREATE OR REPLACE TRIGGER Print_salary_changes
BEFORE DELETE OR INSERT OR UPDATE ON Emp_tab
FOR EACH ROW
WHEN (new.Empno > 0)
DECLARE
sal_diff number;
BEGIN
sal_diff := :new.sal - :old.sal;
dbms_output.put('Old salary: ' || :old.sal);
dbms_output.put(' New salary: ' || :new.sal);
dbms_output.put_line(' Difference ' || sal_diff);
END;
/
Flyway 5.0 now comes with a feature called Error Handlers that lets you do exactly this. You can now create an error handler that turns that warning into an error as simply as
import org.flywaydb.core.api.FlywayException;
import org.flywaydb.core.api.errorhandler.Context;
import org.flywaydb.core.api.errorhandler.ErrorHandler;
import org.flywaydb.core.api.errorhandler.Warning;
public class OracleProcedureFailFastErrorHandler implements ErrorHandler {
#Override
public boolean handle(Context context) {
for (Warning warning : context.getWarnings()) {
if ("99999".equals(warning.getState()) && warning.getCode() == 17110) {
throw new FlywayException("Compilation failed");
}
}
return false;
}
}
More info in the docs: https://flywaydb.org/documentation/errorhandlers
I had the same error when my scripts had a "CREATE TABLE XXX AS SELECT..." statement.
I fixed it by splitting it into two separate statements:
CREATE TABLE XXX (columns def...);
INSERT INTO TABLE XXX (columns...)
SELECT...;
Our Continuous Inegration server (Hudosn) is having a strange issue when attempting to run a simple create table statement in Teradata.
This statement tests the existence of the max_call table:
unless $teradata_connection.table_exists? :arm_custom_db__max_call_attempt_parameters
$teradata_connection.run('CREATE TABLE all_wkscratchpad_db.max_call_attempt_parameters AS (SELECT * FROM arm_custom_db.max_call_attempt_parameters ) WITH NO DATA')
end
The table_exists? method does the following:
def table_exists?(name)
v ||= false # only retry once
sch, table_name = schema_and_table(name)
name = SQL::QualifiedIdentifier.new(sch, table_name) if sch
from(name).first
true
rescue DatabaseError => e
if e.to_s =~ /Operation not allowed for reason code "7" on table/ && v == false
# table probably needs reorg
reorg(name)
v = true
retry
end
false
end
So as per the from(name).first line, the test which this method is performing is just a simple select statement, which, in SQL, looks like: SELECT TOP 1 MAX(CAST(MAX_CALL_ATTEMPT_CNT AS BIGINT)) FROM ALL_WKSCRATCHPAD_DB.MAX_CALL_ATTEMPT_PARAMETERS
The above SQL statement executes perfectly fine within Teradata SQL Assistant, so it's not a SQL syntax issue. The generic ID which our testing suite (Rubymine) uses is also not the issue; that ID has select access to the arm_custom_db.
The exeption which I can see is being thrown (within the builds console output on Hudson) is
Sequel::DatabaseError: Java::ComTeradataJdbcJdbc_4Util::JDBCException. Since this execption is a subclass of DatabaseError, the exception shouldn't be the problem either.
Also: We use unless statements like this every day for hundreds of different tables, and all except this one work correctly. This statement just seems to be a problem.
The complete error message which appears in the builds console output of Hudson is as follows:
[2015-01-07T13:56:37.947000 #16702] ERROR -- : Java::ComTeradataJdbcJdbc_4Util::JDBCException: [Teradata Database] [TeraJDBC 13.10.00.17] [Error 3807] [SQLState 42S02] Object 'ALL_WKSCRATCHPAD_DB.MAX_CALL_ATTEMPT_PARAMETERS' does not exist.: SELECT TOP 1 MAX(CAST(MAX_CALL_ATTEMPT_CNT AS BIGINT)) FROM ALL_WKSCRATCHPAD_DB.MAX_CALL_ATTEMPT_PARAMETERS
Sequel::DatabaseError: Java::ComTeradataJdbcJdbc_4Util::JDBCException: [Teradata Database] [TeraJDBC 13.10.00.17] [Error 3807] [SQLState 42S02] Object 'ALL_WKSCRATCHPAD_DB.MAX_CALL_ATTEMPT_PARAMETERS' does not exist.
I don't understand why this specific bit of code is giving me issues...there does not appear to be anything special about this table or database, and all SQL code executes perfectly fine in Teradata when I am signed in with the same exact user ID that is being used to execute the code from Hudson.