Ruby cannot find sqlite3 driver on windows

前端 未结 8 2213
野趣味
野趣味 2021-02-08 10:21

I am trying to set up Ruby on Rails on windows. I am using the Flash Rails distribution that looks pretty good, but there is an issue with sqlite3. I found the threads telling m

相关标签:
8条回答
  • 2021-02-08 11:01

    Something similar happened to me recently so I thought I'd update my answer.

    For reference there's a sqlite3_api.dll file located in the gem's lib directory. Also the sqlite3.dll file needs to be reachable on the path. They are different files, the first is required by the gem to interface Ruby to C code, while the second contains the actual Sqlite implementation.

    It's best to get the second file from the sqlite website and extract it to the Ruby\bin directory (as you shouldn't manually put DLL's into the windows or windows\system directories any more).

    So for reference "sqlite3_api.dll" needs to be in:

    Ruby\lib\ruby\gems\1.8\gems\sqlite3-ruby-1.2.3-x86-mswin32\lib
    

    and "sqlite3.dll" needs to be on the path, possibly in:

    Ruby\bin
    

    As for the "driver not found" problem I would suggest trying the easy things first and making sure gems is installed correctly, up to date, and that the RUBYLIB and PATH environment variables are set appropriately. (System restart may be required to propagate the changes fully.)

    0 讨论(0)
  • 2021-02-08 11:02

    Try going to sqlite.org download page and get the zipped up dll. Then put that in your c:\windows\system32 folder, that should allow Ruby to find it.

    0 讨论(0)
  • 2021-02-08 11:03

    Try installing the sqlite3-ruby gem:

    gem install sqlite3-ruby
    
    0 讨论(0)
  • 2021-02-08 11:07

    To clarify, which gem are you using? sqlite-ruby or sqlite3-ruby?

    They're part of the same project, but different releases. The key is that sqlite3 appears to have driver code included.

    I assume you're attempting to use the first, since it's giving me the same error. If so, try switching.


    Also.. How literal do you mean by this?

    but I have the dll in my %PATH%

    1. PATH=...;C:\sqlite\sqlite3.dll
    2. PATH=...;C:\sqlite

    The first will attempt to find C:\sqlite\sqlite3.dll\sqlite3.dll, AFAIK.

    0 讨论(0)
  • 2021-02-08 11:14

    I use Ruby 1.8.7 (works with 1.9.1 too) OS is WindowsXP SP3

    1. Go to http://www.sqlite.org/download.html and Download file sqlitedll-3_7_0_1.zip (265.19 KiB) and unzip then we will get sqlite3.dll

    2. Copy sqlite3.dll to your bin folder as C:\Ruby191\bin or C:\Ruby187\bin then it works

    0 讨论(0)
  • 2021-02-08 11:16

    The problem put simply is that sqlite3-ruby 1.2.3 is not compatible with ruby 1.9. This is caused because ruby 1.9 does not use .dll files for c libraries it uses .so files instead. Additionally, since sqlite3_api.dll is written against msvcrt-ruby18.dll. This means that it specifically only will support ruby 1.8.*.

    The good news is that there is a fat binary version that will support both ruby 1.8 and ruby 1.9. Uninstalling all former versions of sqlite3-ruby and then installing this one. (You may have to manually delete some versions the gem after uninstalling.) in order to install it use

    install sqlite3-ruby --source http://gems.rubyinstaller.org
    

    for more information see this website

    0 讨论(0)
提交回复
热议问题