Unable to open socket error (Sequel+TinyTds)

71 views
Skip to first unread message

Filipe A Moreira

unread,
Mar 17, 2011, 6:57:19 AM3/17/11
to rails-sqlse...@googlegroups.com
Hi everyone,

I have posted this question to the Sequel list and they advised me to ask here. Sorry for the noise.

I've got a rails(+ sinatra) app that I am trying to make it work using Sequel + TinyTds (to connect to SQL Server 2000). I'm using sequel (3.21.0) with TinyTds (unreleased master branch) and everything is fine on my dev box. 

When I try to run the app on my production box I get:
  TinyTds::Error: Unable to open socket (Sequel::DatabaseConnectionError)

When trying the connection using irb and using the same setup as the main app (Sequel + TinyTds) I have no problems connecting to the database server.

So everything works on my dev box, the connection works on irb using both Sequel and TinyTds. But not when running the main app.

Thank you

Ken Collins

unread,
Mar 17, 2011, 7:33:33 AM3/17/11
to rails-sqlse...@googlegroups.com

Hey Filipe,

I still think this is a matter of the FreeTDS conf not being found by the user owning the process on the production box and here is why. You had said that you can console into an irb session on the production box using the full stack and it works. If that is so, just because that works for your user and maybe your user sudo'd to another does not mean it will work for that singular user process started by some other means. I say this false positive test can exist because it is possible that when you change owner to another user and depending on the local setup, some environment configs are maintained. Here are some other questions.

1) What is the server application process/user?
2) Where is the freetds.conf file on the server? Have you tried copying that to something top level /usr/local/etc?
3) Where does $ tsql  -C show the conf directory is?


 - Ken

Filipe A Moreira

unread,
Mar 17, 2011, 8:07:42 AM3/17/11
to rails-sqlse...@googlegroups.com
Hi Ken,

Thank you for helping me with this issue. What I meant was that when I try to connect to the database using irb (with either only TinyTds or Sequel+TinyTds) I have no problem. 

The error just appears when I try to run my Rails app (using the console 'rails s' or 'rails c'). Then I get the 'Unable to open socket' error. 

So to recap: 
  * Same user (when using irb and trying to run 'rails s')
  * Same config file supposed to be accessed
$ tsql -C
Compile-time settings (established with the "configure" script)
                            Version: freetds v0.83.dev.20110316
             freetds.conf directory:     /usr/local/etc
     MS db-lib source compatibility: no
        Sybase binary compatibility: no
                      Thread safety:       yes
                      iconv library:          yes
                        TDS version:       5.0
                              iODBC:         no
                           unixodbc:         no
              SSPI "trusted" logins:    no
                            Keberos:         no

Thank you





Ken Collins

unread,
Mar 17, 2011, 8:18:23 AM3/17/11
to rails-sqlse...@googlegroups.com

OK, now to the rails stack.

1) What does your database.yml look like?
2) How is TinyTDS bundled?

> --
> You received this message because you are subscribed to the Google Groups "Rails SQLServer Adapter" group.
> To post to this group, send email to rails-sqlse...@googlegroups.com.
> To unsubscribe from this group, send email to rails-sqlserver-a...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/rails-sqlserver-adapter?hl=en.

Filipe A Moreira

unread,
Mar 17, 2011, 8:31:16 AM3/17/11
to rails-sqlse...@googlegroups.com
Hi Ken,

1) The Rails app has Mongodb has the main database and I have a Sinatra app that deals with the legacy database (where I'm getting the problem). The sinatra app has a model.rb file that defines the database connection and the models.

2) TinyTds is bundled using Gemfile with the relevant part of the file below:

  gem 'tiny_tds', :git => 'https://github.com/filipeamoreira/tiny_tds.git', :branch => 'my-deploy'

I'm using this branch because the master branch upstream was giving an error. 

The same setup is used (same gems) when using the irb console and the Rails app.

Thanks


  
   
Reply all
Reply to author
Forward
0 new messages