Search code examples
db2robotframeworkjaydebeapi

Query returns Error despite being executed succesfully (Robot Framework / JayDeBeApi)


Using the Keyword Query from the Robot Framework DatabaseLibrary JayDeBeApi in conjunction with DB2 like this: ${results}= Query CREATE TABLE SCHEMANAME.TEST_TEMP (id BIGINT, name VARCHAR(25)) is being executed (table exists afterwards).

But nevertheless RobotFramework throws a FAIL and ${results} contains the Message DatabaseError: com.ibm.db2.jcc.am.SqlSyntaxErrorException: DB2 SQL Error: SQLCODE=-601, SQLSTATE=42710, SQLERRMC=SCHEMANAME.TEST_TEMP;TABLE, DRIVER=4.14.122 and often even a very simple Message Error after running the same statement.

Running the query above (copy/paste) directly within a database SQL window doesn't return any errors.

How is it possible, in RobotFramework the query is executed successfully but nevertheless an error is thrown?


Solution

  • The error SQLCODE=-601 means that you are trying to create an object that already exists. So when you say that the table exists afterwards, it means that it existed before you ran the statement. I don't know the framework you are using, but the explanation by @pavelsaman in comment seems to be a very likely cause.