“找不到sqlite3”在轨道上的红宝石错误 [英] "sqlite3 not found" error in ruby on rails

查看:118
本文介绍了“找不到sqlite3”在轨道上的红宝石错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



然后下载并安装MySql ...



创建了我的第一个目录演示。

然后使用 ruby​​ script / server 启动服务器

>

在浏览器中输入 http:// localhost:3000 网址,然后得到一个欢迎登机的页面..所有这一切都到现在为止......

现在我使用 ruby​​脚本/生成控制器创建控制器说 >



控制器已创建,它看起来像这样

  class SayController< ApplicationController 
def hello

end
end

然后,我创建一个视图文档 hello.html.erb ,看起来像这样。

 < HTML> 
< body>
< h1> Hello World !!!< / h1>
< / body>
< / html>

现在我输入url http:// localhost:3000 / say / hello 在浏览器中出现以下错误:

此应用程序无法启动,因为找不到sqlite3.dll。重新安装应用程序可能会解决此问题。和浏览器显示一个默认错误页面



我做了一些Google搜索并尝试了以下内容。



1.gem install sqlite-ruby
$ b 2.gem install sqlite3-ruby



第一个返回成功消息....第二个最初给出成功消息,然后用无定义错误。

我甚至没有开始使用模型...为什么它甚至在sqlite中抛出异常..?!因为这是我第一次尝试使用RoR ...



在此先感谢...

>解决方案

sqlite3自Rails 2.0.2以来一直是默认数据库 - 以前它是MySQL。数据库配置可以在config / database.yml中找到,你可以根据需要改变它。



即使没有模型,rails也会尝试确保数据库中指定的实际DBMS .yml是有用的。



您安装的gems是驱动程序,可让您通过ruby与数据库交谈(类似于Java中的JDBC驱动程序或ADO。 .NET驱动程序) - 不是实际的DBMS。 (sqlite3-ruby是正确的 - 我不知道为什么它会显示所有那些没有定义......的行 - 它也适用于我,但它可以工作,也许别人知道为什么......) p>

.dll是DBMS。 SQLite3是一个非常轻量级的数据库 - 将路径中的.dll放在一个地方真的是你需要做的。将它放在ruby / bin目录中是开发机器的常见做法。


I am very new to RoR... I installed Ruby and installed its gems...

then downloaded and installed MySql...

created my first directory demo.

then started the server using ruby script/server

entered the http://localhost:3000 url in the browser and get a "welcome aboard" page..all is well till now...

now I create a controller using ruby script/generate controller Say

the controller is created and it looks like this

class SayController < ApplicationController
 def hello

 end
end

I then create a view document hello.html.erb which looks like this..

<html>
<body>
    <h1>Hello World!!!</h1>
</body>
</html>

now I enter the url http://localhost:3000/say/hello in the browser and I get the following error

This application failed to start because sqlite3.dll was not found. Re-installing the application may fix this problem. and the browser shows a default error page

I did a bit of Googling and tried the following..

1.gem install sqlite-ruby

2.gem install sqlite3-ruby

the first returned a success message....the second initially gives a success message and then floods me with no definition errors.

I have not even started using models...why is it even throwing exceptions in sqlite..?! am totally confused and lost here since it is my first try with RoR...

thanks in advance...

解决方案

sqlite3 has been the default database since Rails 2.0.2 - previously it was MySQL. Database configuration is found in config/database.yml and you can change it if you want.

Even with no models, rails attempts to make sure the actual DBMS specified in database.yml is there for use.

The gems you installed are "drivers" to let you talk to the database through ruby (similar to JDBC drivers in Java or an ADO.NET driver for .NET) - not the actual DBMS. (sqlite3-ruby is the right one - I'm not sure why it displays all those "no definition for..." lines - it does for me too, but it works. Perhaps someone else knows why...)

The .dll is the DBMS. SQLite3 is a very lightweight database - dropping the .dll in the path is really all you need to do. Placing it in the ruby/bin directory is a common practice for development machines.

这篇关于“找不到sqlite3”在轨道上的红宝石错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆