# Using sql compact from ruby

**URL:** <https://www.ruby-forum.com/t/using-sql-compact-from-ruby/123423>\
**Category:** Ruby\
**Created:** [December 17, 2007, 3:45pm UTC](https://www.ruby-forum.com/t/using-sql-compact-from-ruby/123423 "2007-12-17T15:45:50Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [December 17, 2007, 3:45pm UTC](https://www.ruby-forum.com/t/using-sql-compact-from-ruby/123423/1 "2007-12-17T15:45:50Z")

</div>

Does anyone have any experience using Sql Compact with Ruby. I tried  
the following code  
require ‘dbi’

@server\_name=‘C:/Temp/F1Backup.sdf’  
@dbh=DBI.connect(“DBI:ADO:Microsoft.SQLSERVER.MOBILE.OLEDB.3.0;Data  
Source=#{@server\_name}”)

if @dbh  
puts “connected”  
else  
puts “not connected”  
end

and received the following error message  
c:/ruby/lib/ruby/site\_ruby/1.8/DBD/ADO/ADO.rb:57:in `connect': Open (DBI::DatabaseError) OLE error code:80004005 in Microsoft OLE DB Provider for ODBC Drivers [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified HRESULT error code:0x80020009 Exception occurred. from c:/ruby/lib/ruby/site_ruby/1.8/dbi.rb: 424:in`connect’  
from c:/ruby/lib/ruby/site\_ruby/1.8/dbi.rb:215:in `connect’  
from sqlCompact.rb:4

Thanks,  
Luis
