Skip to content

Commit

Permalink
Update test suite for latest JRuby/JDBC approach.
Browse files Browse the repository at this point in the history
  • Loading branch information
pat committed Jun 19, 2017
1 parent d8b4aa2 commit 1f71e6a
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions spec/support/sphinx.rb
Expand Up @@ -4,6 +4,7 @@
if RUBY_PLATFORM == 'java'
require 'java'
require 'jdbc/mysql'
Jdbc::MySQL.load_driver
end

if ENV["TRAVIS"] == "true"
Expand Down Expand Up @@ -57,8 +58,12 @@ def setup_mysql
end

def setup_mysql_on_jruby
address = "jdbc:mysql://#{host}"
client = java.sql.DriverManager.getConnection(address, username, password)
address = "jdbc:mysql://#{host}"
properties = Java::JavaUtil::Properties.new
properties.setProperty "user", username if username
properties.setProperty "password", password if password

client = Java::ComMysqlJdbc::Driver.new.connect address, properties

set = client.createStatement.executeQuery('SHOW DATABASES')
databases = []
Expand Down

0 comments on commit 1f71e6a

Please sign in to comment.