 |
Forums |
Admin Start New Thread
By: Etienne van Tonder
RE: Support for Sybase ASA [ reply ] 2008-05-20 09:58
|
Hi Carl,
Thank you for your response it's much appreciated.
I'm using the "Adaptive Server Anywhere 9.00.02.3420 (from iAnywhere Solutions Inc.) with Windows XP (SP2).
For now I've monkey-patched it using the following code:
module ActiveRecord
module ConnectionAdapters
class ODBCAdapter < AbstractAdapter
alias :orig_dbmsNameToSym :dbmsNameToSym
def dbmsNameToSym(dbmsName, dbmsVer)
begin
# Call original method
symbl = orig_dbmsNameToSym(dbmsName, dbmsVer)
rescue ActiveRecord::ActiveRecordError
# Catch exception if db not found in existing list, check
# if SybaseASA, if not raise exception
if dbmsName =~ /adaptiveserveranywhere/i
symbl = :sqlanywhere
else
raise ActiveRecord::ActiveRecordError, "ODBCAdapter: Unsupported database (#{dbmsName})"
end
end
return symbl
end
end
end
end
I've been using it for the past few days without any problems (fingers crossed!). I will let you know if I have any issues.
Regards,
Etienne.
|
By: Carl Blakeley
RE: Support for Sybase ASA [ reply ] 2008-05-20 09:24
|
Etienne,
If Sybase ASA is the same as SQLAnywhere then the change you've made is fine and should be all you need to do. Please let me know if you need to make any other changes or hit problems. Once these are sorted out we could add Sybase ASA to the list of supported databases.
Which ODBC driver / OS are you using?
Thanks,
Carl Blakeley
|
By: Etienne van Tonder
Support for Sybase ASA [ reply ] 2008-05-19 02:40
|
Hi,
Firstly thank you for providing this software I think it's going to be very useful.
I'm running Sybase Adaptive Server Anywhere V9.0.2.3420 which I would like to access using the ODBC adapter. After installation I try and run my application but get the following error message "ODBCAdapter: Unsupported database (adaptiveserveranywhere)"
I'm fairly sure that Sybase ASA is the same as SQLAnywhere so I changed the following line in odbc_adapter.rb (line #:1585) to get me going from:
elsif dbmsName =~ /SQLAnywhere/i
to:
elsif dbmsName =~ /SQLAnywhere/i or dbmsName =~ /adaptiveserveranywhere/i
So far everything seems to work fine, I'm able to retrieve and edit data from my DB. I've not tried insert yet but I will I just don't have time right now.
Is this a reasonable change, if so is it possible to get the change added?
Thanks,
Etienne.
|
|
 |