Hi Jeremy,
I have solved the connection (using odbc) doing like this:
db = Sequel.connect(:adapter=>'odbc',:driver=>'SQL
Server',:server=>'localhost',:uid=>user,:pwd=>pass,:database=>mydb,:db_type=>'mssql')
Here are the tracebacks for both issues(in case that it could help
some how):
db = Sequel.odbc(mydb, :uid=>
my_user,pwd=>my_pass,:db_type=>'mssql',:driver=>'SQL Server')
c:/ruby/lib/ruby/gems/1.8/gems/sequel-3.3.0/lib/sequel/adapters/
odbc.rb:35:in `drvconnect': TypeError can't convert Symbol into String
(Sequel::DatabaseConnectionError)
from c:/ruby/lib/ruby/gems/1.8/gems/sequel-3.3.0/lib/sequel/
adapters/odbc.rb:35:in `connect'
from c:/ruby/lib/ruby/gems/1.8/gems/sequel-3.3.0/lib/sequel/
database.rb:92:in `initialize'
from c:/ruby/lib/ruby/gems/1.8/gems/sequel-3.3.0/lib/sequel/
connection_pool.rb:169:in `call'
from c:/ruby/lib/ruby/gems/1.8/gems/sequel-3.3.0/lib/sequel/
connection_pool.rb:169:in `make_new'
from c:/ruby/lib/ruby/gems/1.8/gems/sequel-3.3.0/lib/sequel/
connection_pool.rb:156:in `available'
from c:/ruby/lib/ruby/gems/1.8/gems/sequel-3.3.0/lib/sequel/
connection_pool.rb:147:in `acquire'
from c:/ruby/lib/ruby/gems/1.8/gems/sequel-3.3.0/lib/sequel/
connection_pool.rb:146:in `synchronize'
from c:/ruby/lib/ruby/gems/1.8/gems/sequel-3.3.0/lib/sequel/
connection_pool.rb:146:in `acquire'
... 6 levels...
from c:/ruby/lib/ruby/gems/1.8/gems/sequel-3.3.0/lib/sequel/
dataset/convenience.rb:196:in `single_record'
from c:/ruby/lib/ruby/gems/1.8/gems/sequel-3.3.0/lib/sequel/
dataset/convenience.rb:203:in `single_value'
from c:/ruby/lib/ruby/gems/1.8/gems/sequel-3.3.0/lib/sequel/
dataset/sql.
rb:94:in `count'
from test_db_tools.rb:13
db = Sequel.odbc(mydb, :uid=>my_user,pwd=>my_pass,:db_type=>'mssql')
c:/ruby/lib/ruby/gems/1.8/gems/sequel-3.3.0/lib/sequel/adapters/
odbc.rb:37:in `initialize': ODBC::Error IM002 (0) [Microsoft][ODBC
Driver Manager] Data source name not found and no default driver
specified (Sequel::DatabaseConnectionError)
from c:/ruby/lib/ruby/gems/1.8/gems/sequel-3.3.0/lib/sequel/
adapters/odbc.rb:37:in `connect'
from c:/ruby/lib/ruby/gems/1.8/gems/sequel-3.3.0/lib/sequel/
adapters/odbc.rb:37:in `connect'
from c:/ruby/lib/ruby/gems/1.8/gems/sequel-3.3.0/lib/sequel/
database.rb:92:in `initialize'
from c:/ruby/lib/ruby/gems/1.8/gems/sequel-3.3.0/lib/sequel/
connection_pool.rb:169:in `call'
from c:/ruby/lib/ruby/gems/1.8/gems/sequel-3.3.0/lib/sequel/
connection_pool.rb:169:in `make_new'
from c:/ruby/lib/ruby/gems/1.8/gems/sequel-3.3.0/lib/sequel/
connection_pool.rb:156:in `available'
from c:/ruby/lib/ruby/gems/1.8/gems/sequel-3.3.0/lib/sequel/
connection_pool.rb:147:in `acquire'
from c:/ruby/lib/ruby/gems/1.8/gems/sequel-3.3.0/lib/sequel/
connection_pool.rb:146:in `synchronize'
... 7 levels...
from c:/ruby/lib/ruby/gems/1.8/gems/sequel-3.3.0/lib/sequel/
dataset/convenience.rb:196:in `single_record'
from c:/ruby/lib/ruby/gems/1.8/gems/sequel-3.3.0/lib/sequel/
dataset/convenience.rb:203:in `single_value'
from c:/ruby/lib/ruby/gems/1.8/gems/sequel-3.3.0/lib/sequel/
dataset/sql.
rb:94:in `count'
from test_db_tools.rb:13
-----
Thanks for you time
On Aug 4, 1:50 pm, Jeremy Evans <[email protected]> wrote:
> On Aug 4, 10:44 am, "Pablo Q." <[email protected]> wrote:
>
>
>
> > Hi folks,
>
> > I need help, I have been trying to connect to sql server using odbc
> > without success.
>
> > This is the code that I'm using:
>
> > db = Sequel.odbc(mydb, :user=>
> > my_user,password=>my_pass,:db_type=>'mssql',:driver=>'{SQL Server}')
> > db[:mytable].count
>
> > but I received the following error.....
>
> > ERROR:
>
> > TypeError can't convert Symbol into String
>
> Can you give me a full traceback for this? Note that mydb, my_user,
> and my_pass all need to be strings, not symbols (I'm guessing that's
> not the problem, as otherwise it wouldn't work below).
>
> > and when I try without specifying the driver :
>
> > db = Sequel.odbc(mydb, :user=>
> > my_user,password=>my_pass,:db_type=>'mssql')
> > db[:mytable].count
>
> > ERROR:
>
> > ODBC::Error IM002 (0) [Microsoft][ODBC Driver Manager] Data Source
> > name not found sand no default driver specified
>
> I haven't tried specifying the :driver option. If you are using
> Windows (at least for XP, not sure about other versions), you can go
> into Data Sources (ODBC) in the Control Panel and add a User or System
> DSN for the database. Then you should be able to connect to it
> without using :driver by just specifying the DSN name as the database
> to which to connect.
>
> I use the following connection string to test Sequel with MSSQL and
> ODBC: odbc:///SQLEXPRESS?db_type=mssql (I'm using Windows integrated
> authentication, so I don't need to specify the user or password).
>
> Jeremy
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"sequel-talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/sequel-talk?hl=en
-~----------~----~----~----~------~----~------~--~---