'[IBM][CLI Driver] CLI0125E Function sequence error on RUBY

require "ibm_db"
=> true

db_config =  {:host=>"ec2-<>.compute.amazonaws.com", :database=>"SAMPLE", :user=>"user", :password=>"pass", :port=>50000}

db_conn = IBM_DB.connect("DATABASE=#{db_config[:database]};HOSTNAME=#{db_config[:host]};PORT=#{db_config[:port]};PROTOCOL=TCPIP;UID=#{db_config[:user]};PWD=#{db_config[:password]};AUTHENTICATION=SERVER;ClientWrkStnName=tester", "", "")
=> #<IBM_DB::Connection:0x00007fa563fbc8f8>

IBM_DB.autocommit(db_conn)
=> 1

IBM_DB.autocommit(db_conn,0)
=> true

IBM_DB.autocommit(db_conn)
=> 0

sql = "INSERT INTO TTE (name, price) VALUES (?,?)"  

stmt = IBM_DB.prepare(db_conn, sql)
#<IBM_DB::Statement:0x00007fa564ce28c0>

value = "string"
IBM_DB.bind_param(stmt,1,value)  
(pry):12: warning: Describe Param Failed: [IBM][CLI Driver] CLI0125E  Function sequence error. SQLSTATE=HY010 SQLCODE=-99999
=> false    

tried another way

 param = ["sr", 1]
=> ["sr", 1]
IBM_DB.execute(stmt, param)

(pry):14: warning: Execute Failed due to: [IBM][CLI Driver] CLI0125E  Function sequence error. SQLSTATE=HY010 SQLCODE=-99999
=> false

Getting CLI0125E Function sequence error for both ways. Not sure how to resolve it.

I'm on Mac catalina, using ibm_db (3.0.5)

.zschrc

export IBM_DB_HOME=/Applications/dsdriver
export DYLD_LIBRARY_PATH=/Applications/dsdriver/lib
export LD_LIBRARY_PATH=/Applications/dsdriver/lib


Solution 1:[1]

There was a mismatch in the table scheme. The field price was not present. Corrected the table schema and the query is working.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 user3636388