On Aug 6, 6:37 pm, Jeremy Evans <[email protected]> wrote:
> On Aug 6, 10:08 am, Ricardo Ramalho <[email protected]>
> wrote:
>
>
>
> > I got it working. Details for DSN-less connections:
>
> > 1. Driver parameters keys must be in uppercase;
> > 2. The connect(server) method in odbc.rb converts all server_opts into
> > driver parameters. There are some that don't concern ODBC
> > like :disconnection_proc and :single_threaded. These were not strings,
> > and were crashing. These can either be ignored or just stringified. I
> > chose the latter for simplicity.
>
> > This was the driver with the minimum fields required, tested using
> > ODBC directly:
> > => #<ODBC::Driver:0x15a32ea0 @attrs={"PORT"=>"1234",
> > "SERVER"=>"1.2.3.4", "UID"=>"user1", "PWD"=>"password",
> > "DRIVER"=>"{FreeTDS}"}, @name="Driver1">
>
> > This was the driver created by the code (with the modifications):
> > #<ODBC::Driver:0x18f72cf0 @name="Sequel ODBC Driver130",
> > @attrs={"DISCONNECTION_PROC"=>"#<Proc:0x0000000018b94020@/opt/ruby-
> > enterprise/lib/ruby/gems/1.8/gems/sequel-3.13.0/lib/sequel/database/
> > misc.rb:43>", "PORT"=>"1234", "ADAPTER"=>"odbc", "UID"=>"user",
> > "SERVER"=>"1.2.3.4", "DB_TYPE"=>"mssql", "PWD"=>"password",
> > "DRIVER"=>"{FreeTDS}", "SINGLE_THREADED"=>"false"}>
> > which is close enough.
>
> > The modifications in odbc.rb:
> > 33c33
> > <             drv.attrs[param.to_s.capitalize] = value
> > --->             drv.attrs[param.to_s.upcase] = value.to_s
>
> > The capitalize part is important, the value.to_s is just a dirty hack.
> > Probably it would be better to
> > ignore :disconnection_proc, :single_threaded, and the like (since they
> > were not passed in the connect call).
>
> > The connect command for sequel irb used in these tests:
> > Sequel.connect(:adapter=>'odbc',:driver=>'FreeTDS',:server=>'1.2.3.4',:port=>1234,
> >  :uid=>'user',:pwd=>'password',:db_type=>'mssql').run("SELECT
> > 1")
>
> > Of course, there should be an entry in obdcinst.ini named FreeTDS.
>
> > Can you update this code to the gem?
>
> Thanks for your investigative work.  I'll test the patch on Monday,
> and if it doesn't break anything, I'll merge it into the master branch
> and it will be available in Sequel 3.15.0 (which will be released in
> early September).  If anyone else can test the patch in their setup
> and let me know the effects (positive, negative, no change), I'd
> appreciate it.
>
> Thanks,
> Jeremy

I've tested it and got DSN-less connections working, so I've merged it
into Sequel: 
http://github.com/jeremyevans/sequel/commit/116766622ed2aee4049278053101067242c45516

This will be available in Sequel 3.15.0, which will be released in
early September. Thanks for your help!

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.

Reply via email to