ODBC, MS SQL Server

B

Bolo

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:in `connect'
from /usr/lib/ruby/1.8/dbi.rb:215:in `connect'
from (irb):2

Can You help me

Thanks
 
G

gregarican

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...
 
B

Bolo

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
 
G

gregarican

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?
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
 
B

Bolo

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
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?
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
 
G

gregarican

I think a reply message in that thread pertained to file access perms
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
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?
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
 
B

Bolo

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:in `connect'
from /usr/lib/ruby/1.8/dbi.rb:215:in `connect'
from (irb):2
gregarican a écrit :
I think a reply message in that thread pertained to file access perms
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
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?

Bolo wrote:
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
 
G

gregarican

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!
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:in `connect'
from /usr/lib/ruby/1.8/dbi.rb:215:in `connect'
from (irb):2
gregarican a écrit :
I think a reply message in that thread pertained to file access perms
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

Hmmm. And you have UNIX ODBC loaded then I would assume too. Here'sa
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?

Bolo wrote:
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
 
B

Bolo

Thanks For your help Now it's working
gregarican a écrit :
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!
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:in `connect'
from /usr/lib/ruby/1.8/dbi.rb:215:in `connect'
from (irb):2
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.

Bolo wrote:
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

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?

Bolo wrote:
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top