Ruby on Rails
SybaseASA (Version #35)

Sybase Adaptive Server Anywhere
(SQL Anywhere Studio)

sybaseanywhere_adapter.zip

WARNING: The sybase adapter does not support reconnecting to the database if it crashes and it requires access to ‘sycomments’!

Rewritten January 2006, including an alternative connection method using the Sybase internal web server. Handy for connecting to a remote database server from a web server which doesn’t have a Sybase client installed. (Sybase web server licensing required obviously.)

_To Install Sybase ASA please see: _ HowToSetupSybaseAdapterOnRails

Tested with Sybase ASA 9.0.2.2551 and Windows XP Professional.
Requires Sybase ASA 9.

Put sybaseanywhere_adapter.rb into e.g. ruby\lib\ruby\gems\1.8\gems\activerecord-1.13.2\lib\active_record\connection_adapters
and sybaseanywhere.rb into e.g. ruby\lib\ruby\gems\1.8\gems\activerecord-1.13.2\lib\active_record\vendor

Edit ‘sybaseanywhere’ into active_record.rb in e.g. ruby\lib\ruby\gems\1.8\gems\activerecord-1.13.2\lib
e.g.


RAILS_CONNECTION_ADAPTERS = %w(mysql postgresql sqlite firebird sqlserver db2 oci sybaseanywhere)

In Windows with a Sybase client installed the ADO (OLEDB) driver is best. It takes its connectivity details from an ODBC data source configuration.
The relevant section in database.yml should be e.g.


development:
adapter: sybaseanywhere
dsn: mydb
username: dba
password: sql
mode: ADO

You will need to get the latest
source distribution of Ruby-DBI from http://ruby-dbi.sourceforge.net/

unzip it, and copy the file
src/lib/dbd_ado/ADO.rb to
e.g. ruby/lib/ruby/site_ruby/1.8/DBD/ADO/ADO.rb

(you may need to create the ADO directory).

ODBC connectivity not yet tested but the relevant ODBC bits need to be sourced [what bits?], as described elsewhere [where? link maybe?].
The database.yml details are the same but use:


mode: ODBC

To use HTTP web service connectivity use e.g.


development:
adapter: sybaseanywhere
mode: HTTP
url: httpCOLON//localhostCOLON80/asademo

Or for a secure setup e.g.


url: httpsCOLON//dbaCOLONsqlCURLYATwwwDOTmydbsrvDOTcomCOLON443/mydb

Instructions on how to configure the server for this mode are in the zip. DBI, ADO and ODBC are NOT required for this mode, nor is a local Sybase client installation.

Micheal Scott Has been inactive for 2 years! Post questions on http://groups.google.com/group/rubyonrails-core for now and put ATTN:Anthony Kelly in the title. I’ll post my email address soon once I have one for Ruby on Rails.
Questions, suggestions etc. to:

Michael Scott
mhs@iqx.co.uk

Sybase Adaptive Server Anywhere
(SQL Anywhere Studio)

sybaseanywhere_adapter.zip

WARNING: The sybase adapter does not support reconnecting to the database if it crashes and it requires access to ‘sycomments’!

Rewritten January 2006, including an alternative connection method using the Sybase internal web server. Handy for connecting to a remote database server from a web server which doesn’t have a Sybase client installed. (Sybase web server licensing required obviously.)

_To Install Sybase ASA please see: _ HowToSetupSybaseAdapterOnRails

Tested with Sybase ASA 9.0.2.2551 and Windows XP Professional.
Requires Sybase ASA 9.

Put sybaseanywhere_adapter.rb into e.g. ruby\lib\ruby\gems\1.8\gems\activerecord-1.13.2\lib\active_record\connection_adapters
and sybaseanywhere.rb into e.g. ruby\lib\ruby\gems\1.8\gems\activerecord-1.13.2\lib\active_record\vendor

Edit ‘sybaseanywhere’ into active_record.rb in e.g. ruby\lib\ruby\gems\1.8\gems\activerecord-1.13.2\lib
e.g.


RAILS_CONNECTION_ADAPTERS = %w(mysql postgresql sqlite firebird sqlserver db2 oci sybaseanywhere)

In Windows with a Sybase client installed the ADO (OLEDB) driver is best. It takes its connectivity details from an ODBC data source configuration.
The relevant section in database.yml should be e.g.


development:
adapter: sybaseanywhere
dsn: mydb
username: dba
password: sql
mode: ADO

You will need to get the latest
source distribution of Ruby-DBI from http://ruby-dbi.sourceforge.net/

unzip it, and copy the file
src/lib/dbd_ado/ADO.rb to
e.g. ruby/lib/ruby/site_ruby/1.8/DBD/ADO/ADO.rb

(you may need to create the ADO directory).

ODBC connectivity not yet tested but the relevant ODBC bits need to be sourced [what bits?], as described elsewhere [where? link maybe?].
The database.yml details are the same but use:


mode: ODBC

To use HTTP web service connectivity use e.g.


development:
adapter: sybaseanywhere
mode: HTTP
url: httpCOLON//localhostCOLON80/asademo

Or for a secure setup e.g.


url: httpsCOLON//dbaCOLONsqlCURLYATwwwDOTmydbsrvDOTcomCOLON443/mydb

Instructions on how to configure the server for this mode are in the zip. DBI, ADO and ODBC are NOT required for this mode, nor is a local Sybase client installation.

Micheal Scott Has been inactive for 2 years! Post questions on http://groups.google.com/group/rubyonrails-core for now and put ATTN:Anthony Kelly in the title. I’ll post my email address soon once I have one for Ruby on Rails.
Questions, suggestions etc. to:

Michael Scott
mhs@iqx.co.uk