Ruby 获取所有可用的 DBI 数据库驱动

require 'dbi'

DBI.available_drivers.each do |driver|
  puts "Driver: " + driver
  DBI.data_sources(driver).each do |dsn|
    puts "    Datasource: " + dsn
  end
end

编程技巧