On Thu, May 20, 2010 at 9:49 AM, Shawn J. Goff <[email protected]> wrote:

> Thanks. I'll try 1.8. I tried using the ODBC driver, but "gem install
> ruby-odbc" is broken on Windows and I haven't fought that battle yet.
> The provider I'm using is the SQLNCLI10 driver. I also tried the
> default one just for kicks, and that had the same problem.
>
> On May 20, 11:05 am, Jeremy Evans <[email protected]> wrote:
> > On May 20, 4:25 am, "Shawn J. Goff" <[email protected]> wrote:
> >
> >
> >
> > > I receive the following after I pull a query using Sequel.ado() on a
> > > Windows Server 2008 system.
> >
> > > WIN32OLERuntimeError: failed to create WIN32OLE object from
> > > `ADODB.Connection' HRESULT error code:0x800401f0 CoInitialize has not
> > > been called.
> >
> > > It never happens on the first query. Sometimes not on the second or
> > > third, but it always eventually comes up within a few tries, and then
> > > it doesn't go away until I restart Sinatra.
> >
> > > Some searching gave me someone else (
> http://redmine.ruby-lang.org/issues/show/2618
> > > ) who had a similar error using win32ole. But I've seen no solution.
> > > I've tried this with 1.9.1 and 1.9.2dev.
> >
> > > I was hoping someone here would have some ideas on how to fix this.
> >
> > I haven't seen that error message before.  Do you get the same error
> > message on 1.8?
> >
> > I would recommend using the ODBC adapter instead of the ADO adapter if
> > you are connecting to SQL Server, or the JDBC adapter if you don't
> > mind using JRuby.  If you must use the ADO adapter, you probably want
> > to specify a :provider option, as the default :provider that ADO uses
> > has a lot of issues.
> >
> > 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]<sequel-talk%[email protected]>
> .
> > For more options, visit this group athttp://
> groups.google.com/group/sequel-talk?hl=en.
>
> --
> 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]<sequel-talk%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/sequel-talk?hl=en.
>

This bug has to do with using WIN32OLE and threads, and I was able to
workaround it in ruby 1.9 by calling CoInitialize explicitly. I modified the
test script in the redmine bug report so that it does generate any
exceptions over here: http://gist.github.com/407804

I haven't used this code in production so YMMV.

pete

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