Ruby scripts on Windows
Possible duplicate:
What is Ruby IDE?
I am doing a simple script using ruby ββon Windows 2003 Server. My questions:
- How do I connect to a database via ODBC? I will be connecting to Sybase on Solaris and MSSQL Server .
- How do I send email through Exchange Server 2003?
Update
- What's the best simple Ruby scripting environment? I am currently using SciTE (which comes with Ruby).
source to share
There is an ODBC package for the Ruby DBI module , or you can try using the Ruby ODBC bindings which also include a Win32 binary.
Here's an example that uses RDI (stolen from here ):
require 'DBI'
# make an ODBC connection
conn = DBI.connect('DBI:ODBC:datasource','your_username','your_password')
# returns a list of the table names from your database
conn.tables
# returns an array with the resultset from your query
rs = conn.select_all('SELECT * FROM TheTable')
(ODBC data sources can be defined using the ODBC Administrator, available through Control Panel / Administration Tools.)
For sending emails, I suggest you simply use the standard Ruby mailing capabilities and connect to your Exchange server via SMTP.
I cannot recommend a Ruby IDE for you, however, as I edit text with VIM. :-) Other people may give you a hint.
source to share
For simple yet powerful use of ado and ruby ββon windows . This is a really good example.
source to share
Note that the ODBC drivers included with the Ruby One-Click installer do not appear to be Unicode aware. (After accessing the SQL Server database from Unix, I used FreeTDS to convert UTF-16 to UTF-8 before getting it from UnixODBC.) I was unable to do a similar conversion on Windows.
source to share