#1267 ✓resolved
dominic

do_oracle not accepting nil path in intializer

Reported by dominic | May 13th, 2010 @ 12:26 AM

When trying to connect to an oracle database with the following connection settings:

connection = { :adapter => 'oracle',
:user => 'xxxxxx', :password => 'mypassword', :host => "myhost.com" }

DataMapper.setup :default, connection

I get the following error:
~ can't convert nil into String c:/tools/ruby-1.8.7-p249-i386-mingw32/lib/ruby/gems/1.8/gems/data_objects-0.10.1/lib/data_objects/connection.rb:74:in initialize': can't convert nil into<br/> String (TypeError)

Reading do_oracle.c from at you should be able to connect if just a host name is specified in a TNS names alias but it doesn't check for this nil before trying to convert.

590 r_path = rb_funcall(uri, rb_intern("path"), 0);

path = StringValuePtr(r_path);

593 // If just host name is specified then use it as TNS names alias
if ((r_host != Qnil && RSTRING_LEN(r_host) > 0) &&

  (r_port == Qnil) &&
  (r_path == Qnil || RSTRING_LEN(r_path) == 0)) {
connect_string = host;

Attached is a patch to correct this that should work I think (I am on windows and cannot compile)

Comments and changes to this ticket

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

Attachments

Tags

Pages