 |
Forums |
Admin Discussion Forums: help Start New Thread
By: Lotus Shree
RE: Informix Ruby connection test failing [ reply ] 2008-05-27 15:50
|
Thanks that helped...
One more question on db connect.
Depending on testing need I need to connect to test server or production server. With informix server information is setup in setnet.
Is there a way to sepecify server info on dbconnect call based on testing needs
thanks...
|
By: Lotus Shree
RE: Informix Ruby connection test failing [ reply ] 2008-05-14 18:11
|
You are right I was missing ruby-informix gem.
I am able to connect to database now.
I am connecting to database using
@db=Informix.connect('dbname','uid', 'pwd')
successfully create new table and inserted values.
but when tried to select value getting,
Informix::DatabaseError: Cardinality violation
tc__testdb_connect.rb:31:in `execute'
I am able to access the table and select row with the same userid/pwd though db access tool. Do I need to provide severname, hostname in connect string?
def test_select_table
stmt= @db.prepare('select name from NameTable')
record= stmt.execute()
puts record.fetch(0)
puts record.fetch(1)
end
thanks....
|
By: Lotus Shree
Informix Ruby connection test failing [ reply ] 2008-05-09 19:26
|
Hi,
I am trying to test informix DB connection thorugh ruby. I worked before but now getting following error
c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_re
quire': no such file to load -- informix (LoadError)
from c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `re
quire'
from tc__testdb_connect.rb:2
Here is source code
--------
require 'rubygems'
require 'informix'
require 'test/unit'
class TC_TestDBConnect < Test::Unit::TestCase
def setup
@db=Informix.connect('testdb','tester', '1234')
end
def test_create_table
@db.execute('create table NameTable(id integer, name char(20))') end
# def test_drop_table
# @db.execute('drop table NameTable')
# end
def test_insert_table
stmt = @db.prepare('insert into NameTable values(3,"Kingkong")')
stmt.execute
end
end
------------
Have following
1) ruby-informix-0.7.1.gem
2)ruby-informix-0.7.1-i386-mswin32.gem
3)ruby-informix-0.7.1
Thanks,
-
Shree
|
|
 |