require 'java'
import 'oracle.jdbc.driver.OracleDriver'
module JavaLang
include_package "java.lang"
end
module JavaSql
include_package "java.sql"
end
#JavaLang::Class.forName("oracle.jdbc.driver.OracleDriver").newInstance
##发现如果直接用Class.forName话根本找不到类。看来jruby是预先导入的直接用import CLASS即可
con =
JavaSql::DriverManager.getConnection( \
"jdbc:oracle:thin:@132.228.129.104:1521:ods","ods","ods")
sql = con.createStatement()
result = sql.executeQuery("select * from dual")
while result.next
puts result.getString(1)
end