[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

ActiveRecord/Oracle without Rails

Drew Olson

2/7/2007 2:07:00 PM

All -

I'm attempting to write a data validation program using ActiveRecord and
connecting to an Oracle 10g database. I've downloaded the ruby-oci8
package, double clicked it to install, and written a simple program
(shown below). However, when I run the program, I get a pop up with the
following error: This application has failed to start because OCI.dll
was not found. Re-installing the application may fix this problem. Also,
this is the error shown on the console after the application exits:

c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.2/lib/active_record/connection_
adapters/oracle_adapter.rb:685:in `oci_connection': Oracle/OCI libraries
could n
ot be loaded: 126: The specified module could not be found. -
c:/ruby/lib/ruby
/site_ruby/1.8/i386-msvcrt/oci8lib.so (LoadError)

Any ideas? I'm confused because when I doubled clicked the ruby-oci8
package, I know it placed oci8lib.so in
c:/ruby/lib/ruby/site_ruby/1.8/i386-msvcrt/oci8lib.so. I'm on a windows
box.

Thanks,
Drew

require 'rubygems'
require 'active_record'

ActiveRecord::Base::establish_connection(
:adapter=>"oci",
:host=>"*****",
:database=>"*****",
:user=>"*****",
:password=>"*****")

class Employee < ActiveRecord::Base
set_table_name "EMPLOYEE"
end

Employee.find(:all).each do |emp|
puts emp
end

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

14 Answers

Jano Svitok

2/7/2007 2:19:00 PM

0

On 2/7/07, Drew Olson <olsonas@gmail.com> wrote:
> All -
>
> I'm attempting to write a data validation program using ActiveRecord and
> connecting to an Oracle 10g database. I've downloaded the ruby-oci8
> package, double clicked it to install, and written a simple program
> (shown below). However, when I run the program, I get a pop up with the
> following error: This application has failed to start because OCI.dll
> was not found. Re-installing the application may fix this problem. Also,
> this is the error shown on the console after the application exits:
>
> c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.2/lib/active_record/connection_
> adapters/oracle_adapter.rb:685:in `oci_connection': Oracle/OCI libraries
> could n
> ot be loaded: 126: The specified module could not be found. -
> c:/ruby/lib/ruby
> /site_ruby/1.8/i386-msvcrt/oci8lib.so (LoadError)
>
> Any ideas? I'm confused because when I doubled clicked the ruby-oci8
> package, I know it placed oci8lib.so in
> c:/ruby/lib/ruby/site_ruby/1.8/i386-msvcrt/oci8lib.so. I'm on a windows
> box.

Look for OCI.dll - it's a dependency for oci8lib.so. It should be 1.
in the oci8lib's dir, 2. somewhere on the $PATH. There are maybe more
options, for details see
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/base/dynamic-link_library_search...

Drew Olson

2/7/2007 2:24:00 PM

0

> Look for OCI.dll - it's a dependency for oci8lib.so. It should be 1.
> in the oci8lib's dir, 2. somewhere on the $PATH. There are maybe more
> options, for details see

I was able to find OCI.dll by downloading the Oracle Instant Client. I
copied it to ruby/bin and now the previously mentioned error is gone.
Thanks for that. However, I'm seeing something new now. Any ideas?

c:/ruby/lib/ruby/site_ruby/1.8/oci8.rb:51:in `init': OCI Library
Initialization
Error (OCIError)
from c:/ruby/lib/ruby/site_ruby/1.8/oci8.rb:51
from
c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `ge
m_original_require'
from
c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `re
quire'
from
c:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.1/lib/active_suppo
rt/dependencies.rb:495:in `require'
from
c:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.1/lib/active_suppo
rt/dependencies.rb:342:in `new_constants_in'
from
c:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.1/lib/active_suppo
rt/dependencies.rb:495:in `require'
from
c:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.1/lib/active_suppo
rt/core_ext/kernel/requires.rb:7:in `require_library_or_gem'
from
c:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.1/lib/active_suppo
rt/core_ext/kernel/reporting.rb:11:in `silence_warnings'
... 9 levels...
from
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.2/lib/active_recor
d.rb:80
from
c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:32:in `ge
m_original_require'
from
c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:32:in `re
quire'
from models.rb:2

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

KUBO Takehiro

2/7/2007 3:55:00 PM

0

Hi,

On 2/7/07, Drew Olson <olsonas@gmail.com> wrote:
> > Look for OCI.dll - it's a dependency for oci8lib.so. It should be 1.
> > in the oci8lib's dir, 2. somewhere on the $PATH. There are maybe more
> > options, for details see
>
> I was able to find OCI.dll by downloading the Oracle Instant Client. I
> copied it to ruby/bin and now the previously mentioned error is gone.
> Thanks for that. However, I'm seeing something new now. Any ideas?

OCI.dll only? You need at least two files. OCI.dll and oraociei10.dll (Basic)
or oraociicus10.dll (BasicLite).

Drew Olson

2/7/2007 4:10:00 PM

0

Takehiro Kubo wrote:
> Hi,
>
> On 2/7/07, Drew Olson <olsonas@gmail.com> wrote:
>> > Look for OCI.dll - it's a dependency for oci8lib.so. It should be 1.
>> > in the oci8lib's dir, 2. somewhere on the $PATH. There are maybe more
>> > options, for details see
>>
>> I was able to find OCI.dll by downloading the Oracle Instant Client. I
>> copied it to ruby/bin and now the previously mentioned error is gone.
>> Thanks for that. However, I'm seeing something new now. Any ideas?
>
> OCI.dll only? You need at least two files. OCI.dll and oraociei10.dll
> (Basic)
> or oraociicus10.dll (BasicLite).

Takehiro-

Thanks for your help! That seemed to solve the problem I was initially
having. I am getting another error now, but I'm assuming this has to do
with connecting to the database. The error is below. Does this mean I
have connected incorrectly? I read that I should not be using :database
within establish_connection. My method currently looks like so:

ActiveRecord::Base::establish_connection(
:adapter=>"oci",
:host=>"hostaddress/schema",
:user=>"user",
:password=>"pass")

Error:

c:/ruby/lib/ruby/site_ruby/1.8/oci8.rb:184:in `logon': ORA-12514:
TNS:listener d
oes not currently know of service requested in connect descriptor
(OCIError)
from c:/ruby/lib/ruby/site_ruby/1.8/oci8.rb:184:in `initialize'
from
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.2/lib/active_recor
d/connection_adapters/oracle_adapter.rb:584:in `new'
from
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.2/lib/active_recor
d/connection_adapters/oracle_adapter.rb:584:in `new_connection'
from
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.2/lib/active_recor
d/connection_adapters/oracle_adapter.rb:620:in `initialize'
from
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.2/lib/active_recor
d/connection_adapters/oracle_adapter.rb:35:in `new'
from
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.2/lib/active_recor
d/connection_adapters/oracle_adapter.rb:35:in `oracle_connection'
from
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.2/lib/active_recor
d/connection_adapters/oracle_adapter.rb:41:in `oci_connection'
from
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.2/lib/active_recor
d/connection_adapters/abstract/connection_specification.rb:262:in `send'
from
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.2/lib/active_recor
d/connection_adapters/abstract/connection_specification.rb:262:in
`connection_wi
thout_query_cache='
from
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.2/lib/active_recor
d/query_cache.rb:54:in `connection='
from
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.2/lib/active_recor
d/connection_adapters/abstract/connection_specification.rb:230:in
`retrieve_conn
ection'
from
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.2/lib/active_recor
d/connection_adapters/abstract/connection_specification.rb:78:in
`connection'
from
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.2/lib/active_recor
d/base.rb:1140:in `add_limit!'
from
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.2/lib/active_recor
d/base.rb:1102:in `construct_finder_sql'
from
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.2/lib/active_recor
d/base.rb:997:in `find_every'
from
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.2/lib/active_recor
d/base.rb:418:in `find'
from models.rb:14

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

KUBO Takehiro

2/7/2007 4:50:00 PM

0

Hi,

On 2/8/07, Drew Olson <olsonas@gmail.com> wrote:
>
> ActiveRecord::Base::establish_connection(
> :adapter=>"oci",
> :host=>"hostaddress/schema",

It is not 'schema' but 'service_name'.
If your target database is Oracle Express Edition, it is 'XE'.

:host=>"hostaddress/XE",

> c:/ruby/lib/ruby/site_ruby/1.8/oci8.rb:184:in `logon': ORA-12514:
> TNS:listener d
> oes not currently know of service requested in connect descriptor

The hostaddress's TNS listener doesn't know the service name.

Drew Olson

2/7/2007 6:12:00 PM

0

Takehiro Kubo wrote:
> The hostaddress's TNS listener doesn't know the service name.

Takehiro -

I've got it working! Thanks for all your help, you've make it quite
easy.

-Drew

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

gennarom

3/15/2007 9:12:00 PM

0

On Feb 7, 2:11 pm, Drew Olson <olso...@gmail.com> wrote:
> Takehiro Kubo wrote:
> > The hostaddress's TNS listener doesn't know the service name.
>
> Takehiro -
>
> I've got it working! Thanks for all your help, you've make it quite
> easy.
>
> -Drew
>
> --
> Posted viahttp://www.ruby-....

Is a "service_name" the same as a SID??
Thanks!

Senthil Krishnamoorthy

8/13/2008 5:31:00 PM

0

Hi Drew Olson ,

could you please help me out that where can i download the below dll's ?

oraociei10.dll
(Basic)
or oraociicus10.dll (BasicLite).


regards,
Senthil Krishnamoorthy
--
Posted via http://www.ruby-....

Jesse Hu

8/26/2008 3:07:00 AM

0

[Note: parts of this message were removed to make it a legal post.]

Pls install Oracle Instant Client
http://www.oracle.com/technology/tech/oci/instantclient/...

2008/8/14 Senthil Krishnamoorthy <senthil@mobile-worx.com>

> Hi Drew Olson ,
>
> could you please help me out that where can i download the below dll's ?
>
> oraociei10.dll
> (Basic)
> or oraociicus10.dll (BasicLite).
>
>
> regards,
> Senthil Krishnamoorthy
> --
> Posted via http://www.ruby-....
>
>


--
Cheers,
Jesse

cainster

5/12/2012 8:38:00 PM

0

On May 12, 4:23 am, Will Dockery <will.dock...@gmail.com> wrote:
> Irkin Invader Zim <fitnessforyou2...@yahoo.com> wrote:
>
>
>
> > Hey, how's the pizza business treating you lately?
> > Has Pasko gotten out of prison yet?
>
> Is that where you've been, prison?

No, lifeless Louie, unlike your hippie-wanna-be ass I went out and got
a life.

>
> I had begun to wonder if you'd died or something.
>


I wish you would. Then your recordings could skyrocket in value from
$0.00 to $00.00.

Man I hate you


> --
> Music & poetry from Will Dockery & Friends:http://www.reverbnation.com/w...