Forums | Admin

Discussion Forums: open-discussion

Start New Thread Start New Thread

 

By: zaq E
ODBC access without user/pass? [ reply ]  
2006-04-11 15:20
the setup:
redhat and fedora installs running RoR, attempting to access a MS SQLServer. Our previous magic is a Python backend getting through via easysoft ODBC-ODBC-Bridge.

following the instructions at http://wiki.rubyonrails.com/rails/pages/HowtoConnectToMicrosoftSQLServerFromRailsOnLinux
we can connect to the DB, with one problem. The python ODBC stuff works without having to add the user/pass into the appDB config. because the ODBC.ini has the DSN/user/pass we only need to tell python about the DSN. In RoR we have to include the DSN/usr/pass to get connectivity. Further complicating things is that we know this configuration IS possible because we had it working for about 5 minutes before an ODBC.ini overwrite caused us to loose it. now working from scratch, following everything to the letter, we can not get ruby-DBI to connect without passing a user/pass


latest and greatest of everything:
ruby 1.8.4
rails 1.1
easysoft 2.0
ruby-odbc-0.997
ruby-dbi-0.1.0


the rubytest code
#!/usr/local/bin/ruby
require "dbi"

#this works
#dbh = DBI.connect('dbi:ODBC:DBNAME','user','pass')

#this doesn't
dbh = DBI.connect('dbi:ODBC: dbi:ODBC:DBNAME')

error is
./rubytest.rb
/usr/local/lib/ruby/site_ruby/1.8/DBD/ODBC/ODBC.rb:95:in `connect': 37000 (18452) [unixODBC][][Microsoft][ODBC SQL Server Driver][SQL Server]Login failed for user '(null)'. Reason: Not associated with a trusted SQL Server connection. (DBI::DatabaseError)
from /usr/local/lib/ruby/site_ruby/1.8/dbi.rb:424:in `connect'
from /usr/local/lib/ruby/site_ruby/1.8/dbi.rb:215:in `connect'


our python just for reference is
def connect (DSN, usr='', pwd='', path = ''):

I can see in dbi.rb
409 def connect(db_args, user, auth, params)
410
411 user = @handle.default_user[0] if user.nil?
412 auth = @handle.default_user[1] if auth.nil?
827 def default_user
828 ['', '']
829 end

which look functionaly identical. anyone got something similar working?

thanks
-zaq