# Legacy database on remote host

**URL:** <https://www.ruby-forum.com/t/legacy-database-on-remote-host/62369>\
**Category:** Rails\
**Created:** [January 18, 2006, 3:31pm UTC](https://www.ruby-forum.com/t/legacy-database-on-remote-host/62369 "2006-01-18T15:31:45Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![beachguy82](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/9dc877/32.png) [@beachguy82](https://www.ruby-forum.com/u/beachguy82)\
**Post date:** [January 18, 2006, 3:31pm UTC](https://www.ruby-forum.com/t/legacy-database-on-remote-host/62369/1 "2006-01-18T15:31:45Z")

</div>

I’m getting this error in webrick then it crashes leaving nothing in the  
log.

ruby: symbol lookup error:  
/usr/lib/ruby/gems/1.8/gems/mysql-2.7/lib/mysql.so: undefined symbol:  
mysql\_sqlstate

Here is the standard query I would normally write to get the data.

select \* from child,parent  
where CONCAT(SUBSTRING(child.item\_number,1,14,‘00’) =  
parent.order\_number and parent.order\_number = ‘4444444444444400’

Here are my models and my database.yml

class Parent \< ActiveRecord::Base  
set\_table\_name :parent  
set\_primary\_key :order\_number  
has\_many :child,  
:class\_name =\>  
‘AppName’,  
:finder\_sql =\>  
“select child.\* from child,parent " +  
"  
where CONCAT(SUBSTRING(child.item\_number,1,14,‘00’) =  
parent.order\_number”  
end  
class Child \< ActiveRecord::Base  
set\_table\_name :child  
set\_primary\_key :item\_number  
belongs\_to :parent,  
:foreign\_key =\>  
‘order\_number’,  
:class\_name  
=\> BeeOrder  
end

development:  
adapter: mysql  
database: legacy\_test  
username: john  
password: doe

# socket: /var/lib/mysql/mysql.sock

host: my\_host  
port: 3306

I"ve been pulling my hair out for a week trying to get this legacy  
database working! Please help!

---

<div class="post-metadata">

**Author:** ![beachguy82](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/9dc877/32.png) [@beachguy82](https://www.ruby-forum.com/u/beachguy82)\
**Post date:** [January 18, 2006, 3:35pm UTC](https://www.ruby-forum.com/t/legacy-database-on-remote-host/62369/2 "2006-01-18T15:35:50Z")

</div>

This is the correct model name, in my hast to change the names before I  
posted I forgot to change this one. Can anyone help?

Here are my models and my database.yml

class Parent \< ActiveRecord::Base  
set\_table\_name :parent  
set\_primary\_key :order\_number  
has\_many :child,  
:class\_name =\>  
‘Child’,  
:finder\_sql =\>  
"select child.\* from child,parent " +  
"  
where CONCAT(SUBSTRING(child.item\_number,1,14,‘00’) =

> Here are my models and my database.yml
> 
> class Parent \< ActiveRecord::Base  
> set\_table\_name :parent  
> set\_primary\_key :order\_number  
> has\_many :child,  
> :class\_name =\>  
> ‘AppName’,  
> :finder\_sql =\>  
> "select child.\* from child,parent " +  
> "  
> where CONCAT(SUBSTRING(child.item\_number,1,14,‘00’) =

---

<div class="post-metadata">

**Author:** ![beachguy82](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/9dc877/32.png) [@beachguy82](https://www.ruby-forum.com/u/beachguy82)\
**Post date:** [January 18, 2006, 4:14pm UTC](https://www.ruby-forum.com/t/legacy-database-on-remote-host/62369/3 "2006-01-18T16:14:20Z")

</div>

…,1,14 ) , ‘00’) = …  
missing ‘)’ perhaps?

---

<div class="post-metadata">

**Author:** ![beachguy82](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/9dc877/32.png) [@beachguy82](https://www.ruby-forum.com/u/beachguy82)\
**Post date:** [January 18, 2006, 4:21pm UTC](https://www.ruby-forum.com/t/legacy-database-on-remote-host/62369/4 "2006-01-18T16:21:47Z")

</div>

Thank you, but I fixed that but I still get the same error.

Rob B. wrote:

> …,1,14 ) , ‘00’) = …  
> missing ‘)’ perhaps?
