Problem with ruby + mysql on windows

B

Bruno Moura

Hello

I'm having a problem to conect and use ruby to performe some operations
with a mysql database. I downloaded the gem mysql 2.7.3 (win32) and
added the windows path with mysql bin and mysql lib entries.When a try
to execute the script below an error occurs, with a message:

Error in the entry of procedure mysql_stmt_row_tell in lib LIBMYSQL.dll?

in the code:

require 'rubygems'
require 'mysql'

m = Mysql.new("localhost","user","pass","database")
r = m.query("SELECT * FROM table")
r.each_hash do |f|
print "#{f['camp1']} - #{f['camp2']}"
end


Could you help me, please?

Thank's

Berable
 
B

Bruno Moura

another error happened:
ruby mysql2.rb
C:/InstantRails-1.6/ruby/lib/ruby/gems/1.8/gems/mysql-2.7.3-mswin32/ext/mysql.so:
998: Acesso inválido ao local de memória. (Invalid Access of memory
location) -
C:/InstantRails-1.6/ruby/lib/ruby/gems/1.8/gems/mysql-2.7.3-mswin32/ext/mysql.so
(LoadError)
from
C:/InstantRails-1.6/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:32:in
`require'
from mysql2.rb:2
Exit code: 1

The code are the same.

Thank's for your interest Roger!
 
B

Bruno Moura

Humm,complicated...

how can I know the right version of library I shoud use?

Roger said:
maybe try a different version of the mysql dll?

Thank's again!
 
R

Roger Pack

Bruno said:
Humm,complicated...

how can I know the right version of library I shoud use?



Thank's again!

For me with your gem, I have
"c:\program files\mysql...\bin" in my path, and
version 14.12 Distrib 5.0.45 [from running mysql --version]
installed and the code that you posted works. That's with XP so maybe
that's a factor.
-R
 
B

Bruno Moura

My code runs in your machine... puts!

mysql Ver 14.12 Distrib 5.0.27, for Win32 (ia32)

humm my number version is bit different...

I'll try to install another version of instant rails or install the
complet
stack at begining (ruby, mysql, rails, not istant rails).

Thank's so much Roger!

Roger said:
Bruno said:
Humm,complicated...

how can I know the right version of library I shoud use?



Thank's again!

For me with your gem, I have
"c:\program files\mysql...\bin" in my path, and
version 14.12 Distrib 5.0.45 [from running mysql --version]
installed and the code that you posted works. That's with XP so maybe
that's a factor.
-R
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top