This is a native SQL Anywhere driver for Ruby. This library wraps the functionality provided by the SQL Anywhere DBCAPI library. This driver is intended to be a base-level library to be used by interface libraries such as Ruby-DBI and ActiveRecord.
This driver can be used with SQL Anywhere 10 and later versions.
This driver is licensed under the Apache License, Version 2.
The official code repository is located on GitHub. The repository can be cloned with:
git clone git://github.com/in4systems/sqlanywhere.git
-
Change to the the test directory
cd test
-
Create a testing database:
dbinit test
-
Start the testing database:
dbeng12 test.db
-
Create the test schema:
dbisql -c "eng=test;uid=dba;pwd=sql" test.sql
-
Run the unit tests:
ruby sqlanywhere_test.rb
If the tests fail to run, make sure you have set up the SQL Anywhere environment variables correctly. For more information, review the online documentation here [http://dcx.sybase.com/index.html#1200/en/dbadmin/da-envvar.html].
This script makes a connection, prints Successful Ruby Connection to the SQL
Anywhere console, then disconnects.
begin
require 'rubygems'
gem 'sqlanywhere'
unless defined? SQLAnywhere
require 'sqlanywhere'
end
end
api = SQLAnywhere::SQLAnywhereInterface.new()
SQLAnywhere::API.sqlany_initialize_interface( api )
api.sqlany_init()
conn = api.sqlany_new_connection()
api.sqlany_connect(conn, "uid=dba;pwd=sql")
api.sqlany_execute_immediate(conn, "MESSAGE 'Successful Ruby Connection'")
api.sqlany_disconnect(conn)
api.sqlany_free_connection(conn)
api.sqlany_fini()
SQLAnywhere::API.sqlany_finalize_interface( api )