Varients of this problem have been posted before. However none of the
solutions have worked for me. Therefore I started with a clean slate.
(1) uninstalled and reinstalled Ruby (version 1.8.6) into standard
directory C:\Ruby using standard installer.
(2) Went to http://sqlite.org/download.html and downloaded
sqlite-3_6_16.zip and sqlitedll-3_6_16.zip to C:\SQLite. Extracted the
files there.
(3) Copied sqlite3.dll and sqlite3.exe to C:\Ruby\bin
(4) Launched a command window, went to C:\Ruby\bin, and executed: “gem
install sqlite3-ruby -v 1.2.3”
Results were positive:
···
===
C:\Ruby\bin>gem install sqlite3-ruby -v 1.2.3
Successfully installed sqlite3-ruby-1.2.3-x86-mswin32
1 gem installed
Installing ri documentation for sqlite3-ruby-1.2.3-x86-mswin32...
Installing RDoc documentation for sqlite3-ruby-1.2.3-x86-mswin32...
No problems detected so far. So I created a very simple script in C:
\Ruby\bin called sql1.rb:
require 'sqlite3'
db = SQLite3::Database.new( "test.db" )
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 )
db.execute( "select * from test" )
Result is this:
C:\Ruby\bin>ruby sql1.rb
./sqlite3.dll: 127: The specified procedure could not be found. -
Init_sqlite3 (LoadError)
./sqlite3.dll
from sql1.rb:2
Same error occurs if the only line in the Ruby script is the: require
'sqlite3'
Machine is an XP machine. Does not have a C:\windows\system32
directory but just in case there was some unknown hard coded
dependency I created that and copied the two sqlite files there
(the .dll and .exe). That did not fix the problem.
The problem is not that C:\Ruby\bin is not in the PATH variable, I
execute "set" and can see it right in the path.
Does anyone have any idea where the root cause of the problem might be?
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?
Is this saying there is something wrong with the downloaded sqlite3
DLL itself?
No, however...
I suggest reinstalling ruby... and since you're on Windows, use the
one-step installer package for Ruby 1.8.6
- Mac
···
--
Posted via http://www.ruby-forum.com/\.
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
···
On Jul 1, 6:27 pm, SunSw0rd <John.Tul...@exeloncorp.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?
--
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:
···
On Jul 1, 10:52 pm, Luis Lavena <luislav...@gmail.com> wrote:
On Jul 1, 6:27 pm, SunSw0rd <John.Tul...@exeloncorp.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
===
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" )