Venks
12/5/2007 3:23:00 AM
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,