How to connect to oracle with jruby


My version of jruby is:
jruby (2.5.3) 2019-08-12 a1ac7ff OpenJDK 64-Bit Server VM 25.212-b04 on 1.8.0_212-b04 +indy +jit [linux-x86_64]

I want to connect to an Oracle database.
A jdbc gem is installed.
Do I need additional things to install?
I’d rather not install the complete Oracle Client software.

To connect to a SQLServer database I used
require “jdbc/mssql”

And I have the following:
jdbc (0.1.1 java)
jdbc-mssql (0.7.0 java)

What is the best way (the least amount of maintenance)?

Regards Hans

Turns out it is relatively simple:
You need a ojdbc8 jar and include it.

require ‘java’
require “/u01/apps//lib/jars/ojdbc8-”

java_import 'java.sql.DriverManager

user = 'system
password = ‘manger’
sql_statement = ‘select * from dual’

connection = java.sql.DriverManager.getConnection(
“jdbc:oracle:thin:@” + connect_string,
statement = connection.create_statement

puts rs.getObject(1)

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs