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
换一种方法
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
获取CLI0125E两种方式的函数序列错误。不确定如何解决该错误。
我在Mac Catalina 上,使用ibm_db(3.0.5)
文件
export IBM_DB_HOME=/Applications/dsdriver
export DYLD_LIBRARY_PATH=/Applications/dsdriver/lib
export LD_LIBRARY_PATH=/Applications/dsdriver/lib
1条答案
按热度按时间6rqinv9w1#
表方案中存在不匹配。字段price不存在。已更正表方案,查询正常工作。