Skip to content

Instantly share code, notes, and snippets.

/ssh-pg Secret

Created May 27, 2016 19:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/f7bd16fc717948cf0066c11673fbb161 to your computer and use it in GitHub Desktop.
Save anonymous/f7bd16fc717948cf0066c11673fbb161 to your computer and use it in GitHub Desktop.
gateway = Net::SSH::Gateway.new(host, login, :password => '')
my_port = gateway.open('127.0.0.1', 5432, 5432)
connection = PG::Connection.open(:dbname => 'dbName', :user => 'user', :password => '', :port => my_port)
result = connection.query(query)
connection.close
gateway.close
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment