Dbi:oci8 problems

Hi, I've a problem with dbi:oci8. I hope that you could help me.
My code is this:

1 require 'dbi'
2 dbh = DBI.connect("dbi:oci8:service_name", "user", "password")
3 rs = dbh.prepare('SELECT * FROM table')
4 rs.execute
5 while rsRow = rs.fetch do
6 p rsRow
7 end
8 rs.finish
9 dbh.disconnect if dbh

I've installed correctly all I need (DBI, OCI8, ...), but I get this
error:

attr.c:178:in oci8lib.so: ORA-24316: illegal handle type
(DBI::DatabaseError)
        from /usr/lib/ruby/site_ruby/1.8/oci8.rb:1591:in `initialize'
        from /usr/lib/ruby/site_ruby/1.8/oci8.rb:780:in `new'
        from /usr/lib/ruby/site_ruby/1.8/oci8.rb:780:in
`column_metadata'
        from /usr/lib/ruby/site_ruby/1.8/oci8.rb:779:in `collect'
        from /usr/lib/ruby/site_ruby/1.8/oci8.rb:779:in
`column_metadata'
        from /usr/lib/ruby/site_ruby/1.8/DBD/OCI8/OCI8.rb:346:in
`column_info'
        from /usr/lib/ruby/site_ruby/1.8/dbi.rb:666:in `column_names'
        from /usr/lib/ruby/site_ruby/1.8/dbi.rb:646:in `execute'
        from test.rb:14

If I comment lines 4-5-6-7 is all ok: load driver, connect and prepare.
I dont't understand what is the problem, the same code with Mysql driver
is ok.
Can you help me?

Thanks, paco

···

--
Posted via http://www.ruby-forum.com/.

Now it's ok, you can view the solution on ruby-oci8 forum. Thanks to
Kubo Takehiron for his help.

Bye
paco

Glauco Magnelli wrote:

···

Hi, I've a problem with dbi:oci8. I hope that you could help me.
My code is this:

1 require 'dbi'
2 dbh = DBI.connect("dbi:oci8:service_name", "user", "password")
3 rs = dbh.prepare('SELECT * FROM table')
4 rs.execute
5 while rsRow = rs.fetch do
6 p rsRow
7 end
8 rs.finish
9 dbh.disconnect if dbh

I've installed correctly all I need (DBI, OCI8, ...), but I get this
error:

attr.c:178:in oci8lib.so: ORA-24316: illegal handle type
(DBI::DatabaseError)
        from /usr/lib/ruby/site_ruby/1.8/oci8.rb:1591:in `initialize'
        from /usr/lib/ruby/site_ruby/1.8/oci8.rb:780:in `new'
        from /usr/lib/ruby/site_ruby/1.8/oci8.rb:780:in
`column_metadata'
        from /usr/lib/ruby/site_ruby/1.8/oci8.rb:779:in `collect'
        from /usr/lib/ruby/site_ruby/1.8/oci8.rb:779:in
`column_metadata'
        from /usr/lib/ruby/site_ruby/1.8/DBD/OCI8/OCI8.rb:346:in
`column_info'
        from /usr/lib/ruby/site_ruby/1.8/dbi.rb:666:in `column_names'
        from /usr/lib/ruby/site_ruby/1.8/dbi.rb:646:in `execute'
        from test.rb:14

If I comment lines 4-5-6-7 is all ok: load driver, connect and prepare.
I dont't understand what is the problem, the same code with Mysql driver
is ok.
Can you help me?

Thanks, paco

--
Posted via http://www.ruby-forum.com/\.