Re: Windows XP problem with Ruby, gem sqlite3-ruby, and SQLite3
by SunSw0rd other posts by this author
Jul 2 2009 7:10AM messages near this date
Re: Windows XP problem with Ruby, gem sqlite3-ruby, and SQLite3
|
Re: Windows XP problem with Ruby, gem sqlite3-ruby, and SQLite3
On Jul 1, 10:52Â pm, Luis Lavena <luislav...@[...].com> wrote:
> On Jul 1, 6:27Â pm, SunSw0rd <John.Tul...@[...].com> wrote:
>
>
>
> > A further symptom on this issue. When I execute irb I detect the
> > following:
> > ===
> > C:\Ruby\bin>irb
> > irb(main):001:0> require 'rubygems'
> > => true
> > irb(main):002:0> require 'sqlite3'
> > LoadError: 127: The specified procedure could not be found. Â -
> > Init_sqlite3
> > ./sqlite3.dll
> > Â Â Â Â from ./sqlite3.dll
> > Â Â Â Â from C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:
> > 31:in `require'
> > Â Â Â Â from (irb):2
> > irb(main):003:0>
> > ===
>
> > Is this saying there is something wrong with the downloaded sqlite3
> > DLL itself?
>
> No, the problem is Ruby itself.
>
> C:\Users\Luis>irb
> irb(main):001:0> require 'rbconfig'
> => true
> irb(main):002:0> RbConfig::CONFIG['DLEXT']
> => "so"
> irb(main):003:0> RbConfig::CONFIG['DLEXT2']
> => "dll"
>
> DLEXT is used to identify Ruby C extensions.
>
> Since you're CD'ing from Ruby\bin, it's finding 'sqlite3.dll' and
> think it is an extension. See this:
>
> C:\Users\Luis>cd Tools\bin
>
> C:\Users\Luis\Tools\bin>dir sqlite*.*
> Â Volume in drive C is Windows7
> Â Volume Serial Number is 50BD-564E
>
> Â Directory of C:\Users\Luis\Tools\bin
>
> 18/05/2009 Â 01:40 p.m. Â Â Â Â Â 505.873 sqlite3.dll
> 21/05/2009 Â 10:03 p.m. Â Â Â Â Â 520.574 sqlite3.exe
> Â Â Â Â Â Â Â Â 2 File(s) Â Â Â 1.026.447 bytes
> Â Â Â Â Â Â Â Â 0 Dir(s) Â 44.951.277.568 bytes free
>
> C:\Users\Luis\Tools\bin>irb
> irb(main):001:0> require 'sqlite3'
> LoadError: 127: The specified procedure could not be found. Â -
> Init_sqlite3
> ./sqlite3.dll
> Â Â Â Â from ./sqlite3.dll
> Â Â Â Â from (irb):1
>
> Now, please try doing the require OUTSIDE Ruby\bin folder.
>
> Also, since you installed sqlite3 as a gem, please require rubygems
> first:
>
> require 'rubygems'
> require 'sqlite3'
>
> HTH
> --
> Luis Lavena
This last post is correct. I had to do this:
(1) move the script to another directory other than C:\Ruby\bin
(2) added require 'rubygems' about the require 'sqlite3'
(3) Make a couple of minor script corrections -- the following now
works fine:
===
require 'rubygems'
require 'sqlite3'
db = SQLite3::Database.new( "test.db" )
db.execute( "drop table if exists the_table " )
sql = <<SQL
create table the_table (
a varchar2(30),
b varchar2(30)
);
insert into the_table values ( 'one', 'two' );
insert into the_table values ( 'three', 'four' );
insert into the_table values ( 'five', 'six' );
SQL
db.execute_batch( sql )
print db.execute( "select * from the_table" )
===
Thread:
SunSw0rd
SunSw0rd
SunSw0rd
Luis Lavena
Michael Linfield
|