ODBC, MS SQL Server

Hello

I try to connect ruby to a MS SQL database . This the error message.

b.michelin@srv-mq-lamp2:~$ irb1.8
irb(main):001:0> require “dbi”
=> true
irb(main):002:0> dbh = DBI.connect(‘dbi:ODBC:DataBase’, ‘user’,
‘password’)
WARNING: no ODBC driver manager found.
DBI::DatabaseError: INTERN (0) [RubyODBC]Cannot allocate SQLHENV
from /usr/lib/ruby/1.8/DBD/ODBC/ODBC.rb:95:in connect' from /usr/lib/ruby/1.8/dbi.rb:424:inconnect’
from /usr/lib/ruby/1.8/dbi.rb:215:in `connect’
from (irb):2

Can You help me

Thanks

This might sound silly, but are you using a Windows-based PC? Judging
by the command line prompt it doesn’t appear to be the case. If so then
you should load UNIX ODBC I believe…

On 1/5/07, Bolo [email protected] wrote:

WARNING: no ODBC driver manager found.
DBI::DatabaseError: INTERN (0) [RubyODBC]Cannot allocate SQLHENV
from /usr/lib/ruby/1.8/DBD/ODBC/ODBC.rb:95:in connect' from /usr/lib/ruby/1.8/dbi.rb:424:in connect’
from /usr/lib/ruby/1.8/dbi.rb:215:in `connect’
from (irb):2

Can You help me

Are you following these instructions?

http://wiki.rubyonrails.org/rails/pages/HowtoConnectToMicrosoftSQLServerFromRailsOnLinux

If so, did you install Ruby ODBC? The steps are listed on the page
above.

Thanks

HTH,
Michael G.

I don’t the anwsers to his question

my db definition
$ nano /etc/odbc.ini

[Corporate]
Driver = FreeTDS
Description = ODBC connection via FreeTDS
Trace = No
Servername = Corporate
Database = FrontOffice

nano /etc/odbcinst.ini:

[FreeTDS]
Description = TDS driver (Sybase/MS SQL)
Driver = /usr/lib/odbc/libtdsodbc.so
Setup = /usr/lib/odbc/libtdsS.so
CPTimeout =
CPReuse =
FileUsage = 1

Hello, Hello

This might sound silly, but are you using a Windows-based PC?

No I use Debian etch. When i this command

isql YOUR_DB_DEFINITION_NAME USERNAME PASSWORD

±--------------------------------------+
| Connected! |
| |
| sql-statement |
| help [tablename] |
| quit |
| |
±--------------------------------------+
SQL> select * from users; (again, do this for a table that exists in
your db)
±-----------±------------------------------+
| id | login |
±-----------±------------------------------+
| 1 | user1 |
| 3 | user2 |
±-----------±------------------------------+
2 rows affected
2 rows returned
SQL> quit

it’s working

Ok Know i have this error message
irb(main):002:0> dbh = DBI.connect(‘dbi:ODBC:Corporate’,
’,'***’)
DBI::DatabaseError: S1000 (0) [unixODBC][FreeTDS][SQL Server]Unable to
connect to data source
from /usr/lib/ruby/1.8/DBD/ODBC/ODBC.rb:95:in connect' from /usr/lib/ruby/1.8/dbi.rb:424:inconnect’
from /usr/lib/ruby/1.8/dbi.rb:215:in `connect’
from (irb):2
gregarican a écrit :

Thanks For your help Now it’s working
gregarican a écrit :

I think a reply message in that thread pertained to file access perms
on those odbc files. Check the two ini files and ensure that the perms
are botching things up.

Hmmm. And you have UNIX ODBC loaded then I would assume too. Here’s a
thread I googled across in terms of Debian UNIX ODBC access →
http://mail.easysoft.com/pipermail/unixodbc-support/2004-November/000237.html.
Perhaps it might apply to you?

I would suggest googling around the FreeTDS message boards. When I just
did it seems as if your situation isn’t unique. Here’s something that
was referred to in terms of ensuring that UNIX ODBC works in
conjunction with FreeTDS →
http://www.freetds.org/userguide/odbcombo.htm#E.G.SAMPLEODBCCOMBO. HTH!