Sha256: 633e6d6eaf520bfaa4072236949b89ad7a275b04b63e40c831da20df9526d276

Contents?: true

Size: 994 Bytes

Versions: 1

Compression:

Stored size: 994 Bytes

Contents

class ActiveRecord::Base
  class << self
    def teradata_connection(config)
      begin
        require 'jdbc/teradata'
        ::Jdbc::Teradata.load_driver(:require) if defined?(::Jdbc::Teradata.load_driver)
      rescue LoadError # assuming driver.jar is on the class-path
      end

      config[:username] ||= Java::JavaLang::System.get_property('user.name')
      config[:host] ||= 'localhost'
      config[:port] ||= 1025
      config[:tmode] ||= 'ANSI' # ANSI, Teradata, DEFAULT
      config[:charset] ||= 'UTF8'
      config[:url] ||= "jdbc:teradata://#{config[:host]}/DATABASE=#{config[:database]},DBS_PORT=#{config[:port]},COP=OFF,tmode=#{config[:tmode]},charset=#{config[:charset]}"
      config[:driver] ||= 'com.teradata.jdbc.TeraDriver'
      config[:adapter_class] = ActiveRecord::ConnectionAdapters::TeradataAdapter
      config[:adapter_spec] = ::ArJdbc::Teradata
      jdbc_connection(config)
    end
    alias_method :jdbcteradata_connection, :teradata_connection
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
activerecord-jdbcteradata-adapter-0.4.1 lib/arjdbc/teradata/connection_methods.rb