# Mysql::Error Table doesn't exist

**URL:** <https://www.ruby-forum.com/t/mysql-error-table-doesnt-exist/164944>\
**Category:** Ruby\
**Created:** [April 7, 2009, 5:38pm UTC](https://www.ruby-forum.com/t/mysql-error-table-doesnt-exist/164944 "2009-04-07T17:38:06Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![mifi](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/7993a0/32.png) [@mifi](https://www.ruby-forum.com/u/mifi)\
**Post date:** [April 7, 2009, 5:38pm UTC](https://www.ruby-forum.com/t/mysql-error-table-doesnt-exist/164944/1 "2009-04-07T17:38:06Z")

</div>

I installed the Windows mysql gem, I’m using MySQL on Windows, and have  
been able to get the connection to work but am having trouble figuring  
out what is happening with my query. What I have is (with non-essential  
parts stripped out):

```
require 'active_record'

# Database connection
begin
    dbconfig = YAML::load(File.open('../conf/database.yml'))
    ActiveRecord::Base.establish_connection(dbconfig)
rescue
    puts $!
end

class TestResults < ActiveRecord::Base
end

io.puts "What Agents do you want to see?\n"
io.print "Agent Name = "
my_agent = io.gets.chomp
io.puts "Looking for #{my_agent}\n"
begin
    agents = TestResults.first()
    io.puts %{Found #{agents.testname} - #{agents.status}}
rescue
    puts $!
end

```

When I run interactively I can enter my Agent name but all I see then  
is:  
Mysql::Error: Table ‘auto\_harness\_development.test\_results’ doesn’t  
exist: SELECT \* FROM `test_results` LIMIT 1

I don’t understand why test\_results is getting appended to the table  
name, or why its being inserted into the select statement as the table  
name, is there a configuration parameter I need to set or am I just  
misusing the query?

---

<div class="post-metadata">

**Author:** ![mifi](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/7993a0/32.png) [@mifi](https://www.ruby-forum.com/u/mifi)\
**Post date:** [April 8, 2009, 7:40pm UTC](https://www.ruby-forum.com/t/mysql-error-table-doesnt-exist/164944/2 "2009-04-08T19:40:01Z")

</div>

So, I ended up taking another look at this today and realized I hadn’t  
been paying as much attention to the naming as I would in Rails.

Changing:

> ```
> class TestResults < ActiveRecord::Base
> 
> ```

to  
class AutoHarnesses \< ActiveRecord::Base

and

> ```
> agents = TestResults.first()
> 
> ```

to  
agents = AutoHarnesses.first()

I get my query to complete, I didn’t realize ActiveRecord here was also  
using the same naming standards as it does within Rails, but I should  
have expected that since the access methods seem to be the same.
