Module: JdbcSpec::ActiveRecordExtensions

Defined in:
lib/jdbc_adapter/jdbc_derby.rb,
lib/jdbc_adapter/jdbc_mysql.rb,
lib/jdbc_adapter/jdbc_hsqldb.rb

Instance Method Summary collapse

Instance Method Details

#derby_connection(config) ⇒ Object



5
6
7
8
9
# File 'lib/jdbc_adapter/jdbc_derby.rb', line 5

def derby_connection(config)
  config[:url] ||= "jdbc:derby:#{config[:database]};create=true"
  config[:driver] ||= "org.apache.derby.jdbc.EmbeddedDriver"
  embedded_driver(config)
end

#h2_connection(config) ⇒ Object



9
10
11
12
13
# File 'lib/jdbc_adapter/jdbc_hsqldb.rb', line 9

def h2_connection(config)
  config[:url] ||= "jdbc:h2:#{config[:database]}"
  config[:driver] ||= "org.h2.Driver"
  embedded_driver(config)
end

#hsqldb_connection(config) ⇒ Object



3
4
5
6
7
# File 'lib/jdbc_adapter/jdbc_hsqldb.rb', line 3

def hsqldb_connection(config)
  config[:url] ||= "jdbc:hsqldb:#{config[:database]}"
  config[:driver] ||= "org.hsqldb.jdbcDriver"
  embedded_driver(config)
end

#mysql_connection(config) ⇒ Object



5
6
7
8
9
10
11
12
13
# File 'lib/jdbc_adapter/jdbc_mysql.rb', line 5

def mysql_connection(config)
  if config[:socket]
    warn "AR-JDBC MySQL on JRuby does not support sockets"
  end
  config[:port] ||= 3306
  config[:url] ||= "jdbc:mysql://#{config[:host]}:#{config[:port]}/#{config[:database]}"
  config[:driver] = "com.mysql.jdbc.Driver"
  jdbc_connection(config)
end