i simply did install gem install mysql.
When i try running the code it shows that error.
I tried to download libmySQL.dll and placed the file at the lib folder
for mysql still it doesn’t seem to work.
ps i did both the following as well but did not work.
Fetching: mysql2-0.4.4.gem (100%)
Building native extensions. This could take a while…
Successfully installed mysql2-0.4.4
Parsing documentation for mysql2-0.4.4
Installing ri documentation for mysql2-0.4.4
Done installing documentation for mysql2 after 2 seconds
1 gem installed
The name for that is mysql2 though. I am not sure which
mysql variant you try - for mysql2 it works for me:
require ‘mysql2’ # => true
Always try to add the information how you installed something
and what your operating system is too. And your ruby version.
Fetching: mysql2-0.4.4.gem (100%)
Building native extensions. This could take a while…
Successfully installed mysql2-0.4.4
Parsing documentation for mysql2-0.4.4
Installing ri documentation for mysql2-0.4.4
Done installing documentation for mysql2 after 2 seconds
1 gem installed
The name for that is mysql2 though. I am not sure which
mysql variant you try - for mysql2 it works for me:
require ‘mysql2’ # => true
Always try to add the information how you installed something
and what your operating system is too. And your ruby version.
Thanks alot bro. I am using RubyMine software with version 2.2.
I always face with this issue whenever i use the require. it’s like
whenever i use require the error always pops up. i tried to google can’t
find it though. and i used mysql2 still doesn’t work for me
Btw i am using Windows 10
? I never did it (simply because I didn’t know that you can do it),
but after seeing your post, I googled, and found the following article,
which might be of interest to you:
? I never did it (simply because I didn’t know that you can do it),
but after seeing your post, I googled, and found the following article,
which might be of interest to you:
Okay, so you can load the module, and you are facing a completely
different problem: There is no module method Mysql2.
Now I don’t know this module and can not tell you how to use it, but a
quick look at Module: Mysql2 — Documentation for mysql2 (0.3.11) (click
on the link “Methods” near the top left corner) shows that there is
indeed not method named connect. May I ask you where you got the idea
from, that such a method might exist? When you read
you will find that the usage pattern of the module looks quiet
differently from what you are doing.
i now reading the peter cooper book. i am following exactly what he did.
Ya it’s like quite different from what you send me the link compared to
what i am doing with the book.
Okay, so you can load the module, and you are facing a completely
different problem: There is no module method Mysql2.
Now I don’t know this module and can not tell you how to use it, but a
quick look at Module: Mysql2 — Documentation for mysql2 (0.3.11) (click
on the link “Methods” near the top left corner) shows that there is
indeed not method named connect. May I ask you where you got the idea
from, that such a method might exist? When you read
He’s using mysql. but it didn’t work on my RubyMine version 2.2. that’s
why i also not sure of this problem.
whenever he mention the using the require thing. my first instinct
always telling me sure have error.
instead of just following the book you need to think about the
“conceptual” steps that are being taken. Often, the names of the
functions will help you.
In this case, you have two pretty clear choices: you work with the mysql
gem, which is 5+ years old but which is used in the book, or you try to
find out how to do what you want with the newer gem.
It’s not very complicated what you want to do because all you want to do
at the moment is
connect to the database
submit queries
You can test this process by using the database from the command line
(although often the connection process is done automatically from the
command line as it may be part of configuring the “database”.)
If you look at the first example on the github page for mysql2 it gives
you some idea about how to do it, but google will always help you find
more examples and answers to problems.
If you can’t get mysql or mariadb to work, try using sqlite. You may
find it generally more easier to use ruby with a unix operating system
but I can’t really comment on this because I don’t use windows.
instead of just following the book you need to think about the
“conceptual” steps that are being taken. Often, the names of the
functions will help you.
In this case, you have two pretty clear choices: you work with the mysql
gem, which is 5+ years old but which is used in the book, or you try to
find out how to do what you want with the newer gem.
It’s not very complicated what you want to do because all you want to do
at the moment is
connect to the database
submit queries
You can test this process by using the database from the command line
(although often the connection process is done automatically from the
command line as it may be part of configuring the “database”.)
If you look at the first example on the github page for mysql2 it gives
you some idea about how to do it, but google will always help you find
more examples and answers to problems.
If you can’t get mysql or mariadb to work, try using sqlite. You may
find it generally more easier to use ruby with a unix operating system
but I can’t really comment on this because I don’t use windows.
Ronald F. wrote in post #1185102:
Should i use Textmate instead through out the book?
I don’t understand what you want to say. I only know “Textmate” being a
texteditor for the Mac (http://macromates.com/download), but this would
make no sense in your case. So, what do you mean by “Textmate”?
Ronald F. wrote in post #1185102:
Should i use Textmate instead through out the book?
I don’t understand what you want to say. I only know “Textmate” being a
texteditor for the Mac (http://macromates.com/download), but this would
make no sense in your case. So, what do you mean by “Textmate”?