Guest User

Untitled

a guest
Nov 17th, 2018
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.34 KB | None | 0 0
  1. require 'tiny_tds'
  2.  
  3. MAX = ARGV.shift.to_i
  4.  
  5. connections = (1..MAX).map do |n|
  6. TinyTds::Client.new host:'ss2008', username:'sa', password:'cheese'
  7. end
  8.  
  9. results = connections.map do |c|
  10. c.execute("SELECT @@SPID AS [pid]").each.first['pid']
  11. end
  12.  
  13. puts "Tested #{MAX} connections."
  14. puts "Process IDs: #{results.inspect}"
  15.  
  16. connections.each { |c| c.close }
Add Comment
Please, Sign In to add comment