Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # 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
Add Comment
Please, Sign In to add comment