Project

net-tns

0.03
No commit activity in last 3 years
No release in over 3 years
A pure Ruby (partial) implementation of the Oracle TNS protocol
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 3.0
~> 1.0

Runtime

~> 2.0
 Project Readme

Net::TNS for Ruby Build Status Coverage Status

Library for connecting to Oracle databases.

Description

Net::TNS for Ruby is a partial implementation of the TNS (Transparent Network Substrate) and TTI (Two-Task Interface, a.k.a. TTC) protocols used by Oracle Database. It allows users to connect and authenticate to databases; functionality beyond that point is limited. The library implements two protocols, and although TTI is the higher-level one, the library is named for TNS, which is more well-known.

Requirements

Net::TNS was written for and has been most tested with Ruby 2. The specs pass on 1.9.3, although their coverage is incomplete. It may be able to work with previous versions.

Installation

gem install net-tns

Use

Because TNS and TTI are highly related (and not very useful without the other), they are both implemented in this library, although in separate namespaces, Net::TNS and Net::TTI (require "net/tti" is sufficient to load both protocols, while require "net/tns" will only load the TNS implementation).

Each namespace includes a Client class, which provides access to the essential functionality for that protocol.

Examples:

Get the version of an Oracle DB server

require "net/tns" # require "net/tti" would work as well
Net::TNS::Client.get_version(:host => "10.0.0.10") # => "11.2.0.2.0"

Try authenticating to a server

require "net/tti" # requiring TTI is necessary to get the higher-level functionality
tti_client = Net::TTI::Client.new
tti_client.connect( :host => "10.0.0.10", :sid => "ORCL" )
begin
  tti_client.authenticate( "jsmith", "bananas" )
  # Authentication succeeded
rescue Net::TTI::Exceptions::InvalidCredentialsError
  # Handle invalid credentials
end
tti_client.disconnect

Contribute

Pull requests welcome! Once you've forked and cloned the project, you can bundle install to take care of the dependencies; after that, you're ready to code.

You can also create issues for any bugs or feature requests, but they may take longer to get done, of course.

Resources on TNS and TTI