[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Re: Ruby works but not JRuby - when using MySQL Driver

Joe L

12/5/2007 3:43:00 AM

Note: parts of this message were removed by the gateway to make it a legal Usenet post.

I'm not sure if this is the case, but seems like it might be. JRuby doesn't support C extensions. I don't know if it can be addressed with that driver. You might be able to use the Java MySQL Driver, keep in mind the free one is GPL.

If I'm wrong about anything, someone correct me.

Joe

Venks <venkatesh.mantha@gmail.com> wrote: Here is the simple Ruby program that works with "Ruby" but gives an
error with "JRuby".

file: connection.rb

================================================
#!/usr/bin/ruby -w
# Use Ruby MySQL module to test connection information

require "mysql"

begin

dbh = Mysql.real_connect("mars", "csread", "csread", "csapp")

puts "Server Info: " + dbh.get_server_info

rescue Mysql::Error => e

puts "Error code: #{e.errno}"
puts "Error message: #{e.error}"
puts "Error SQLSTATE: #{e.sqlstate}" if e.respond_to?("sqlstate")

ensure

dbh.close if dbh

end
====================================================

Below is the error while running with JRuby:

connection.rb:4: /usr/lib/ruby/gems/1.8/gems/mysql-2.7/mysql.so:0:
Invalid char `\177' in expression (SyntaxError)
from connection.rb:4:in `require'
from connection.rb:4

Is this a compatibility issue between JRuby and MySQL driver writting
in Ruby? Is this expected behaviour or can this be addressed?

Thanks,




---------------------------------
Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it now.