From: Ernest Ellingson Date: 2001-01-10T11:52:45+09:00 Subject: [ruby-talk:8974] Re: Database access with ADO I don't know if 1.6.1 has a bug that's been fixed in 1.6.2 but I have used ADO successfully. However, I'm using a connection object and getting a record set by having the connection object execute a SQL statement. e.g. require 'win32ole' oConn=WIN32OLE.new('ADODB.Connection') oConn.ConnectionString="DSN=xxxxx;uid=xxxx;pwd=xxxx" oConn.Open rs=oConn.Execute("SQLString") At 11:24 1/10/2001 +0900, you wrote: >I am a Ruby newbie, drawn to the language by the DDJ article. I'm about to >start on my first decent project in the language, but I've encountered a few >problems with the (lack of) database support. I run on WinNT, using Ruby >1.6.1 installed by the windows installer. > >My initial approach to databasing was to use the win32ole library to make an >ADODB-type connection - bypassing the need to go through an ODBC library >directly and letting COM do the work. The database is MS SQL, but that >shouldn't matter for ADO. The test code is below... > > require 'win32ole' > records = WIN32OLE.new('ADODB.RecordSet') > records.Open('SELECT * FROM PRODUCT;', 'FILEDSN=adotest.dsn') > printf('%i\n',records.RecordCount) > puts('press ENTER') > gets > records.Close > >The output is rather ugly: >adotest.rb:3: [BUG] Segmentation fault >ruby 1.6.1 (2000-10-05) [i386-cygwin] > 0 [sig] ruby 1031 stackdump: Dumping stacktrace to ruby.exe.stackdump > >This is the same error I get when attempting to run the excel1.rb sample >shipped with win32ole. > >Is this a problem with the library or with what I'm attempting to do? Any >way around it? > >Thanks, >David Naseby