Created
March 3, 2010 14:22
-
-
Save mikiobraun/320637 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# gems you need | |
# | |
# dbi | |
# dbd-jdbc | |
# jdbc-postgres | |
require 'java' | |
require 'rubygems' | |
require 'dbi' | |
require 'dbd/Jdbc' | |
require 'jdbc/postgres' | |
# connect to database 'foobar' | |
# with user 'foobar' and password 'quux' | |
DBI.connect('DBI:Jdbc:postgresql://localhost/foobar', | |
'foobar', 'quux', | |
'driver' => 'org.postgresql.Driver') do |dbh| | |
puts "Connected" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment