This isnt totally a rails question; I am using ActiveRecord for storing
some simple values into a database. My problem; I keep gettign MySQL
Errors. On the Win32 machine it was off and on. Now on the linux
machine (ubuntu) I can’ t connect at all. I have all the password
settings correct.
My only thought, I am working with Threads and thought that might cause
the issue, but I removed the threading out of it, so no dice there.
Word: a Count: 270
ERR: invalid process URL state
Mysql::Error: Lost connection to MySQL server during query: SELECT *
FROM numbers_feed_links WHERE (
parsed = ‘0’) ORDER BY created_on desc
Here is kind of a unit-test
Berlin B.
Used to test active record connection
Run with:
ruby connect_db.rb
require ‘active_record’
require ‘logger’;
Use the following to reformat the logging message:
class Logger; def format_message(severity, timestamp, msg, progname)
“#{msg}\n” end; end
ActiveRecord::Base.logger = Logger.new(STDOUT)
ActiveRecord::Base.establish_connection(
:adapter => “mysql”,
:host => “localhost”,
:username => “USER_NAME”,
:password => “PASSWORD”,
:database => “botverse_development”
)
@logger = Logger.new(STDOUT)
Continue
Active Record Class setup ---------------
class NumbersLink < ActiveRecord::Base
end
Main Entry Point
def ruby_main
@logger.info “Connecting.”
Create a dummy record
link = NumbersLink.new()
link.main_url = “http://www.yahoo.com”
link.url_title = “The Title”
link.created_on = Time.now
if link.save
@logger.info(“Record was successfully created.”)
else
@logger.info(“ERR: Could not create record”)
end
@logger.info “Done.”
end
ruby_main
Once the record is saved, you will get the following message:
Record was successfully created.
End of File
Database Schema (MySQL)
– Create the simple user blog
– Users have user-links
CREATE TABLE numbers_links (
id int(11) NOT NULL auto_increment,
main_url varchar(255) NOT NULL,
url_title varchar(128) NOT NULL,
url_description varchar(255),
source varchar(255),
keywords varchar(255),
created_on DATETIME DEFAULT ‘0000-00-00 00:00:00’,
PRIMARY KEY (id)
);
-------- New Report being run Wednesday 05/03/2006 03:52 AM
–
Berlin B.
(ramaza3 on freenode)
http://www.newspiritcompany.com
http://www.newspiritcompany.com/newforums
also checkout alpha version of botverse:
http://www.newspiritcompany.com:8086/universe_home