Sha256: 3d1ea3626e10871b2e676c7a5e4052e2cd78ad73e893af8345a596f0eabc546c

Contents?: true

Size: 567 Bytes

Versions: 2

Compression:

Stored size: 567 Bytes

Contents

require 'dbi'
require 'dbd/Jdbc'
require 'jdbc-vertica'
require 'dotenv'

# Create .env file containing
# HOSTNAME=
# PORT=
# USERNAME=
# PASSWORD=
Dotenv.load

config = {
  hostname: ENV['HOSTNAME'],
  port:     ENV['PORT'] || "5433",
  username: ENV['USERNAME'],
  password: ENV['PASSWORD'],
}
puts config

Jdbc::Vertica.load_driver
DBI.connect(
  "DBI:Jdbc:vertica://#{config[:hostname]}:#{config[:port]}/",
  config[:username],
  config[:password],
  'driver' => 'com.vertica.jdbc.Driver'
) do |dbh|
  puts "Connected"
  p dbh.select_all('select * from dt;')
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
jdbc-vertica-0.0.3 example/connect_and_show_tables.rb
jdbc-vertica-0.0.2 example/connect_and_show_tables.rb