Class: ActiveRecord::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/arjdbc/sqlanywhere/connection_methods.rb

Class Method Summary collapse

Class Method Details

.sqlanywhere_connection(config) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
# File 'lib/arjdbc/sqlanywhere/connection_methods.rb', line 3

def sqlanywhere_connection( config )
  version4 = true
  begin
    Java::com.sybase.jdbc4.jdbc.SybDriver
  rescue NameError
    version4 = false
  end
  config[:port] ||= 2638
  config[:url] ||= "jdbc:sybase:Tds:#{config[:host]}:#{config[:port]}?serviceName=#{config[:database]}"
  config[:driver] ||= version4 ? "com.sybase.jdbc4.jdbc.SybDriver" : "com.sybase.jdbc3.jdbc.SybDriver"
  config[:dialect] = "sqlanywhere"
  jdbc_connection(config)
end