# SQLite and Ruby DLL problem

**URL:** <https://www.ruby-forum.com/t/sqlite-and-ruby-dll-problem/179559>\
**Category:** Ruby\
**Created:** [November 28, 2009, 2:04pm UTC](https://www.ruby-forum.com/t/sqlite-and-ruby-dll-problem/179559 "2009-11-28T14:04:20Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![tutiplain](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/77aa72/32.png) [@tutiplain](https://www.ruby-forum.com/u/tutiplain)\
**Post date:** [November 28, 2009, 2:04pm UTC](https://www.ruby-forum.com/t/sqlite-and-ruby-dll-problem/179559/1 "2009-11-28T14:04:20Z")

</div>

Hello all,

I am trying to get Ruby to work with SQLite under Windows. I  
installed the Sqlite-ruby gem, but whenever I do this:

require ‘sqlite’

I get an error saying that sqlite.dll was not found. I have downloaded  
de SQLite DLL, and placed it in the Windows folder, the system32 folder  
and inside  
C:\ruby\lib\ruby\gems\1.8\gems\sqlite-ruby-2.2.3-x86-mswin32\lib.

But the error persists. Where must I place this DLL to get SQLite to  
work?

Thanks for any info.

---

<div class="post-metadata">

**Author:** ![tutiplain](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/77aa72/32.png) [@tutiplain](https://www.ruby-forum.com/u/tutiplain)\
**Post date:** [November 28, 2009, 3:09pm UTC](https://www.ruby-forum.com/t/sqlite-and-ruby-dll-problem/179559/2 "2009-11-28T15:09:52Z")

</div>

Omar C. wrote:

> Hello all,
> 
> I am trying to get Ruby to work with SQLite under Windows. I  
> installed the Sqlite-ruby gem, but whenever I do this:
> 
> require ‘sqlite’
> 
> I get an error saying that sqlite.dll was not found. I have downloaded  
> de SQLite DLL, and placed it in the Windows folder, the system32 folder  
> and inside  
> C:\ruby\lib\ruby\gems\1.8\gems\sqlite-ruby-2.2.3-x86-mswin32\lib.
> 
> But the error persists. Where must I place this DLL to get SQLite to  
> work?
> 
> Thanks for any info.

There is difference beetween sqlite.dll and sqlite3.dll. Which are you  
using.

I have downloaded mine from [SQLite Download Page](http://www.sqlite.org/download.html) and  
putted windows binaries into ruby bin directory whic is BTW in widows  
path.

Are you using sqlite3-ruby gem?

by  
TheR

---

<div class="post-metadata">

**Author:** ![tutiplain](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/77aa72/32.png) [@tutiplain](https://www.ruby-forum.com/u/tutiplain)\
**Post date:** [November 28, 2009, 3:47pm UTC](https://www.ruby-forum.com/t/sqlite-and-ruby-dll-problem/179559/3 "2009-11-28T15:47:10Z")

</div>

On Nov 28, 10:04 am, Omar C. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> C:\ruby\lib\ruby\gems\1.8\gems\sqlite-ruby-2.2.3-x86-mswin32\lib.

Forgot to mention:

When you require, please do this:

require ‘rubygems’  
require ‘sqlite3’

Since you’re installing an old SQLite/Ruby bindings for SQLite 2, but  
installing the gem for SQLite 3.

Follow the tutorial link I sent before and should get you started.

---

<div class="post-metadata">

**Author:** ![tutiplain](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/77aa72/32.png) [@tutiplain](https://www.ruby-forum.com/u/tutiplain)\
**Post date:** [November 28, 2009, 3:46pm UTC](https://www.ruby-forum.com/t/sqlite-and-ruby-dll-problem/179559/4 "2009-11-28T15:46:00Z")

</div>

On Nov 28, 10:04 am, Omar C. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> C:\ruby\lib\ruby\gems\1.8\gems\sqlite-ruby-2.2.3-x86-mswin32\lib.
> 
> But the error persists. Where must I place this DLL to get SQLite to  
> work?
> 
> Thanks for any info.

Please follow this tutorial:

[http://blog.mmediasys.com/2009/07/06/getting-started-with-rails-and-sqlite3/](http://blog.mmediasys.com/2009/07/06/getting-started-with-rails-and-sqlite3/)

You don’t need to install Rails, but just for you to setup a proper  
Ruby version (either 1.8.6 or 1.9.1) and setup SQLite3 properly to  
work with Ruby.

Note that sqlite3-ruby version 1.2.5 was released officially, so you  
don’t need to indicate --source at the installation command.

Please look for “RubyInstaller Release Candidate 1” and not the old  
One-Click Installer packages. RubyForge sucks at the package listing  
and filtering, so please pay attention to what you download.

Hope this helps,

---

<div class="post-metadata">

**Author:** ![tutiplain](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/77aa72/32.png) [@tutiplain](https://www.ruby-forum.com/u/tutiplain)\
**Post date:** [November 28, 2009, 5:49pm UTC](https://www.ruby-forum.com/t/sqlite-and-ruby-dll-problem/179559/5 "2009-11-28T17:49:10Z")

</div>

Luis L. wrote:

> On Nov 28, 10:04ï¿½am, Omar C. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:
> 
> > C:\ruby\lib\ruby\gems\1.8\gems\sqlite-ruby-2.2.3-x86-mswin32\lib.
> 
> Forgot to mention:
> 
> When you require, please do this:
> 
> require ‘rubygems’  
> require ‘sqlite3’
> 
> Since you’re installing an old SQLite/Ruby bindings for SQLite 2, but  
> installing the gem for SQLite 3.
> 
> Follow the tutorial link I sent before and should get you started.

Hi again,

Thanks for your replies. I made a mistake, I thought I was installing  
the gem for ‘sqlite’ when in reality it was ‘sqlite3’. The DLL I copied  
was sqlite3.dll. This time I placed it in  
C:\ruby\lib\ruby\1.8\i386-mswin32.

I tested using irb:

C:\Ruby\gem\_install\>irb  
irb(main):001:0\> require’rubygems’  
=\> false  
irb(main):002:0\> require’sqlite3’  
LoadError: 127: The specified procedure could not be found. -  
Init\_sqlite3  
C:/Ruby/lib/ruby/1.8/i386-mswin32/sqlite3.dll  
from C:/Ruby/lib/ruby/1.8/i386-mswin32/sqlite3.dll  
from  
C:/Ruby/lib/ruby/site\_ruby/1.8/rubygems/custom\_require.rb:31:in `re  
quire’  
from (irb):2  
irb(main):003:0\> exit

When I use the rdoc server, I can see the ‘rubygems’ gem installed, I  
don’t understand why it returns false. I will check out the link you  
sent and see if it helps, in the meantime, if you have any other  
suggestions I’ll be glad to know what they are. Thanks again.

---

<div class="post-metadata">

**Author:** ![tutiplain](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/77aa72/32.png) [@tutiplain](https://www.ruby-forum.com/u/tutiplain)\
**Post date:** [November 28, 2009, 6:31pm UTC](https://www.ruby-forum.com/t/sqlite-and-ruby-dll-problem/179559/6 "2009-11-28T18:31:37Z")

</div>

On Nov 28, 1:49 pm, Omar C. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> C:\ruby\lib\ruby\1.8\i386-mswin32.  
> from C:/Ruby/lib/ruby/1.8/i386-mswin32/sqlite3.dll

You should not put the DLL inside the gem folder structure.

Please follow the instructions as I commented in a previous post.

---

<div class="post-metadata">

**Author:** ![tutiplain](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/77aa72/32.png) [@tutiplain](https://www.ruby-forum.com/u/tutiplain)\
**Post date:** [November 29, 2009, 3:56am UTC](https://www.ruby-forum.com/t/sqlite-and-ruby-dll-problem/179559/7 "2009-11-29T03:56:39Z")

</div>

Luis L. wrote:

> On Nov 28, 1:49ï¿½pm, Omar C. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:
> 
> > C:\ruby\lib\ruby\1.8\i386-mswin32.  
> > ï¿½ ï¿½ ï¿½ ï¿½ from C:/Ruby/lib/ruby/1.8/i386-mswin32/sqlite3.dll
> 
> You should not put the DLL inside the gem folder structure.
> 
> Please follow the instructions as I commented in a previous post.

Hi again,

I finally got it to work, but had to do a clean ruby install. I  
copied the dll, def and sqlite.exe files to th ruby bin directory, and  
after some more internet digging, I found a post about ruby searching  
for extensions in the bin folder, and to run the script outside that  
directory. After doing so, it worked correctly, I was even able to do  
“rake db:create” for a Rails test app. Thanks for all your help.

---

<div class="post-metadata">

**Author:** ![tutiplain](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/77aa72/32.png) [@tutiplain](https://www.ruby-forum.com/u/tutiplain)\
**Post date:** [November 28, 2009, 6:00pm UTC](https://www.ruby-forum.com/t/sqlite-and-ruby-dll-problem/179559/8 "2009-11-28T18:00:35Z")

</div>

Luis L. wrote:

> On Nov 28, 10:04ï¿½am, Omar C. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:
> 
> > C:\ruby\lib\ruby\gems\1.8\gems\sqlite-ruby-2.2.3-x86-mswin32\lib.
> 
> Forgot to mention:
> 
> When you require, please do this:
> 
> require ‘rubygems’  
> require ‘sqlite3’
> 
> Since you’re installing an old SQLite/Ruby bindings for SQLite 2, but  
> installing the gem for SQLite 3.
> 
> Follow the tutorial link I sent before and should get you started.

Hi, I followed the steps on the link you sent, but I still get the same  
error message. I am doing this with Ruby 1.8 (The O. Click Installer  
version). Any other suggestions are welcome.
