Help getting started with tiny_tds

149 views
Skip to first unread message

Brian Thomas

unread,
Jul 22, 2015, 11:34:17 AM7/22/15
to Rails SQLServer Adapter
I too am new to Rails, and I'm working on an app which connects to an existing Azure SQL Server DB.

I've successfully installed: 
- tiny_tds 0.6.2

- activerecord-sqlserver-adapter 4.2.4

and I'm using rails 4.2.1 (for no good reason other than it is the default)


As a first step I tried making the connection in the rails console like this:


> client = TinyTds::Client.new username: 'user@server', password: 'secret', host: 'server.database.windows.net', database: 'DBName', azure: true

=>  #<TinyTds::Client:0x007fc215bf43a0 @query_options={:as=>:hash, :symbolize_keys=>false, :cache_rows=>true, :timezone=>:local, :empty_sets=>true}> 


which I don't completely understand the Client:0x007fc215bf43a0 part, but if I check client.active?  I get true 

If I check in azure, it shows a successful connection too - so all good.


But, when I try and execute a query it gets weirder


> result = client.execute("select * from [users]")

=> #<TinyTds::Result:0x007fc215be4608 @query_options={:as=>:hash, :symbolize_keys=>false, :cache_rows=>true, :timezone=>:local, :empty_sets=>true}> 


To check what's in result I try:

> result.fields                and I get the following error which crashes the rail console.


dyld: lazy symbol binding failed: Symbol not found: _rb_thread_blocking_region

  Referenced from: /Users/Brian/.rvm/gems/ruby-2.2.0/gems/tiny_tds-0.6.2/lib/tiny_tds/tiny_tds.bundle

  Expected in: flat namespace


dyld: Symbol not found: _rb_thread_blocking_region

  Referenced from: /Users/Brian/.rvm/gems/ruby-2.2.0/gems/tiny_tds-0.6.2/lib/tiny_tds/tiny_tds.bundle

  Expected in: flat namespace




Any suggestions?  Thanks!


Brian Thomas

unread,
Jul 22, 2015, 3:59:53 PM7/22/15
to Rails SQLServer Adapter
Figured it out.

Issue 176 is pretty clear that this was an incompatibility with Ruby 2.2

Installed v0.6.3.rc1 and everything worked fine.

Now, on to figuring out how to build a rails app on top of an existing DB - good times.

Chris Downey

unread,
Jul 22, 2015, 4:13:24 PM7/22/15
to rails-sqlse...@googlegroups.com
Hi Brian,

Building a Rails app on top of an existing DB is how I got started with Rails, too.  Feel free to email me directly if you get stuck.  The good news is that you'll go (by necessity) deeper into Rails more quickly than you otherwise might, and when you eventually create a brand new app with a new DB, you'll have a better appreciation for Rails db conventions.  

best,

Chris

--
You received this message because you are subscribed to the Google Groups "Rails SQLServer Adapter" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rails-sqlserver-a...@googlegroups.com.
To post to this group, send email to rails-sqlse...@googlegroups.com.
Visit this group at http://groups.google.com/group/rails-sqlserver-adapter.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages