I have an app that has been running for years. We then migrated the server to Ubuntu 15.04 and installed Ruby.
sudo apt-get install curl
sudo apt-get install ruby2.1
sudo gem update --system
sudo apt-get install rake
apt-get install ruby-dev
sudo gem install amatch
sudo apt-get install libmysqlclient-dev
sudo gem install -r dbi
sudo gem install -r mysql dbd-mysql
Then we ran the program and get this err..
/var/lib/gems/2.1.0/gems/dbi-0.4.5/lib/dbi.rb:300:in `block in load_driver': Unable to load driver 'MySQL' (underlying error: uninitialized constant DBI::DBD::MySQL) (DBI::InterfaceError)
from /usr/lib/ruby/2.1.0/monitor.rb:211:in `mon_synchronize'
from /var/lib/gems/2.1.0/gems/dbi-0.4.5/lib/dbi.rb:242:in `load_driver'
from /var/lib/gems/2.1.0/gems/dbi-0.4.5/lib/dbi.rb:160:in `_get_full_driver'
from /var/lib/gems/2.1.0/gems/dbi-0.4.5/lib/dbi.rb:145:in `connect'
The program itself (with user name and pw changed)
#!/usr/bin/ruby
require "rubygems"
gem 'mysql'
gem 'dbi'
require "dbi"
require "amatch"
include Amatch
name_sub = { "unit" => "un",
"unt" => "un",
"tract" => "tr",
"estate" => "est",
"university" => "univ",
"trust" => "trst" }
op_sub = { "partnership" => "PS",
"partnershp" => "PS",
"partner" => "PS",
"prtnr" => "PS",
"ptnr" => "PS",
"ptnrsp" => "PS",
"corporation" => "C",
"corp" => "C",
"company" => "co",
"incorporation" => "I",
"inc" => "I",
"oil" => "O",
"gas" => "G",
"exploration" => "E",
"production" => "P",
"operating" => "oper",
"energy" => "engy",
"management" => "mgmt",
"resources" => "res",
"minerals" => "min",
"petroleum" => "pet" }
def mangle(s, dictionary = {})
return "" unless s
# lowercase | special case | alphanumerics only
s.downcase().gsub(/l.l.c./, 'llc').gsub(/\W/, " ").split(" ").map do |word|
dictionary.fetch(word, word)
end.join(' ')
end
stop_attempts = -1
PRODUCTION = false
begin
# now the actual code
# development database
DBI.connect("dbi:MySQL:database=matching;" "host=enus", "mott", "bM^7ezOqYyn") do |outdb|
DBI.connect("dbi:MySQL:database=ownership;" "host=enus", "mott", "bM^7ezOqYyn") do |lease_db|
# re-create phase3 table
outdb.do("drop table if exists phase3")
sql = "create table phase3 (" +
"id bigint not null auto_increment primary key, " +
"lod_id bigint, rrc_id bigint, district varchar(255), " +
"name_percent float, rrc_lease_no varchar(255)," +
"op_percent float, field_percent float, total float, " +
"key k1 (lod_id), key k2 (rrc_id), key k3 (district), " +...
An exhaustive Google search found recommendations of installing dbd-mysql, and other suggestions but none worked.
So what is failing here? I'm not a Ruby guy, I'm a lowly IT guy trying to get this back up and running.