Sha256: cbb7dec3f3ed0e704f15657a34e0b5d021ade579622d1517da3188204abf45ec
Contents?: true
Size: 1.28 KB
Versions: 1
Compression:
Stored size: 1.28 KB
Contents
class ActiveRecord::Base class << self def mssql_connection(config) require 'active_record/connection_adapters/jdbcmssql_adapter' config[:host] ||= "localhost" config[:port] ||= 1433 config[:driver] ||= defined?(::Jdbc::JTDS.driver_name) ? ::Jdbc::JTDS.driver_name : 'net.sourceforge.jtds.jdbc.Driver' config[:adapter_spec] = ::ArJdbc::MsSQL config[:url] ||= begin url = "jdbc:jtds:sqlserver://#{config[:host]}:#{config[:port]}/#{config[:database]}" # Instance is often a preferrable alternative to port when dynamic ports are used. # If instance is specified then port is essentially ignored. url << ";instance=#{config[:instance]}" if config[:instance] # This will enable windows domain-based authentication and will require the JTDS native libraries be available. url << ";domain=#{config[:domain]}" if config[:domain] # AppName is shown in sql server as additional information against the connection. url << ";appname=#{config[:appname]}" if config[:appname] url end unless config[:domain] config[:username] ||= "sa" config[:password] ||= "" end jdbc_connection(config) end alias_method :jdbcmssql_connection, :mssql_connection end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
activerecord-jdbc-adapter-1.2.5 | lib/arjdbc/mssql/connection_methods.rb |