Error "sqlite3 not found" in ruby ​​on rails

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

then download and install MySql ...

created my first catalog demo.

then started the server using ruby script / server

entered http: // localhost: 3000 url in the browser and got the welcome page on board ... everything is fine so far ...

now create a controller using ruby script / generate controller Say

a controller is created and it looks like

class SayController < ApplicationController def hello end end 

Then I create a document of the form 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. Reinstalling the application may fix this problem. and the browser displays the default error page

I did a little googling and tried the following.

1.gem install sqlite-ruby

2.gem install sqlite3-ruby

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

I did not even start using models ... why does it even throw exceptions in sqlite ..?! I am completely confused and lost here, since this is my first attempt with RoR ...

thanks in advance...

+1
source share
2 answers

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

Even without models, the rails try to make sure that the actual DBMS specified in database.yml is used for use.

The stones you have installed are "drivers" that allow you to talk to the database through ruby ​​(like the JDBC drivers in Java or the ADO.NET driver for .NET) - not a real DBMS. (sqlite3-ruby is correct - I'm not sure why it displays all these lines "there is no definition for ..." - this is also for me, but it works. Maybe someone else knows why ...)

.dll - DBMS. SQLite3 is a very lightweight database. Dropping the DLL into the path is all you need. Placing it in the ruby ​​/ bin directory is common practice for development machines.

+2
source

found a solution ... I don't know if this is a hack or a workaround ... but it works ... I made a copy of sqlite3.dll and pasted it into a ruby ​​/ bin floder, and it works. !!

but I would like to know if this is a real solution ...

0
source

Source: https://habr.com/ru/post/896547/


All Articles