Created
          April 1, 2013 10:29 
        
      - 
      
- 
        Save oinume/5284189 to your computer and use it in GitHub Desktop. 
    Connecting to MySQL with JRuby and JDBC.
  
        
  
    
      This file contains hidden or 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
    
  
  
    
  | require 'java' | |
| require 'rubygems' | |
| require 'dbi' | |
| require 'dbd/Jdbc' | |
| require 'jdbc/mysql' | |
| Jdbc::MySQL.load_driver | |
| DBI.connect( | |
| 'DBI:Jdbc:mysql://localhost/test', | |
| 'root', 'root', | |
| 'driver' => 'com.mysql.jdbc.Driver' | |
| ) do |dbh| | |
| puts "Connected" | |
| end | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
            
This code works good! 😄