'ADO'에 해당되는 글 2건
- 2009/03/27 ADO.NET for SQLite
- 2007/05/07 Ruby, ADO 이용한 SQL Server 연결
SQLite는 일반적으로 PHP 등에서 먼저 채택해서 많이 알려준 Database인데요
.NET C# 에서도 소형의 Database 면서 강력한 SQLite DB를 사용하려면 어떻게 해야할지 갑자기 궁금증이 생겨서 찾아봤더니 위와 같은 주소가 있더군요.
두 링크는 각각 다른 역할 입니다.
먼저 첫번째 ADO.NET 2.0 Provider for SQLite는 .NET 환경에서 SQLite를 이용하여 개발하기 위한 Provider 고요.
ADO를 통해서 SQLite에 접속하려면 이 Provider가 있어야 가능하겠죠.
그리고 두번째 링크는 필수 항목은 아니지만 SQLite를 조금 더 편하게 사용하기 위한 Wrapper Library입니다.
ADO.NET을 이용해서 DB는 필요한데 부담스러운 경우가 많죠.
사용자 환경에 데이터가 저장되어야 하는 가계부나 일기장 이런 프로그램은 확실히 사용자 환경에 DB가 있어야 할겁니다.
기존에 Access에서 이용하던 MDB같은 좋은 애들도 있지만 MDB 보안 문제 등 문제점도 있어서 MDB를 이용하지 않고 SQLite를 이용해 보는것도 좋을 것 같네요.
뭐 아직 저도 SQLite를 이용한 개발은 안해봤지만요 -_ -;;
나중에 위 자료를 이용한 개발을 하게되면 테스트 예제를 별도로 포스팅 하도록 하고 이만 마칩니다.
'.NET > ADO.NET' 카테고리의 다른 글
| ADO.NET for SQLite (0) | 2009/03/27 |
|---|---|
| LINQ to SQL Debug Visualizer (0) | 2007/08/08 |
RUBY로 win32 OLE 를 이용해 ADO 연결하는 방법을 아래 소개합니다.
출처 : http://rubyonwindows.blogspot.com/search/label/sqlserver
require 'win32ole'
class SqlServer
# This class manages database connection and queries
attr_accessor :connection, :data, :fields
def initialize
@connection = nil
@data = nil
end
def open
# Open ADO connection to the SQL Server database
connection_string = "Provider=SQLOLEDB.1;"
connection_string << "Persist Security Info=False;"
connection_string << "User ID=USER_ID;"
connection_string << "password=PASSWORD;"
connection_string << "Initial Catalog=DATABASE;"
connection_string << "Data Source=IP_ADDRESS;"
connection_string << "Network Library=dbmssocn"
@connection = WIN32OLE.new('ADODB.Connection')
@connection.Open(connection_string)
end
def query(sql)
# Create an instance of an ADO Recordset
recordset = WIN32OLE.new('ADODB.Recordset')
# Open the recordset, using an SQL statement and the
# existing ADO connection
recordset.Open(sql, @connection)
# Create and populate an array of field names
@fields = []
recordset.Fields.each do |field|
@fields << field.Name
end
begin
# Move to the first record/row, if any exist
recordset.MoveFirst
# Grab all records
@data = recordset.GetRows
rescue
@data = []
end
recordset.Close
# An ADO Recordset's GetRows method returns an array
# of columns, so we'll use the transpose method to
# convert it to an array of rows
@data = @data.transpose
end
def close
@connection.Close
end
end
You can then use this class as follows:
db = SqlServer.new
db.open
db.query("SELECT PLAYER FROM PLAYERS WHERE TEAM = 'REDS';")
field_names = db.fields
players = db.data
db.close
'Program > RUBY' 카테고리의 다른 글
| Test-First Development for Rails (0) | 2007/08/07 |
|---|---|
| Ajax on Rails (0) | 2007/07/10 |
| Ruby를 이용한 Directory 보는 구문 (0) | 2007/05/19 |
| Ruby, ADO 이용한 SQL Server 연결 (0) | 2007/05/07 |
| Ruby App. CD-ROM 열기 (0) | 2007/05/06 |
| 루비(Ruby) 로 초간단 프로그램 작성 (2) | 2007/04/29 |

Prev




