Without closing the connection
require "dbi" URL = "dbi:Oracle:oracle.neumann" DBI.connect(URL, "scott", "tiger") do | dbh | p dbh.select_all("SELECT * FROM EMP") end