 | Level: Intermediate Robert Thornton (ret1@acm.org), Java Consultant, Daugherty Business Solutions
30 Jan 2007 JRuby is an implementation of the Ruby programming language that runs in the Java™ Virtual Machine (JVM). This tutorial demonstrates how to install and configure JRuby to connect to the Apache Derby database. As Ruby and Ruby on Rails become more popular, JRuby becomes an interesting technology to leverage the portability, security, and class libraries of the JVM while using Ruby features like simple syntax and closures. If you're writing a small application that needs a relational database, or you want to be able to ship a database with your product, then the Derby database is an excellent choice for a persistence mechanism. This tutorial shows you two methods of connecting to and building Derby database applications from JRuby.
Objectives - Learn how to connect to and use the Apache Derby database via the
JRuby interpreter using two different methods.
- Learn how to insert data into and retrieve it from Derby via JRuby.
Prerequisites
You should be familiar with Java code and JDBC. Experience with Ruby isn't
necessary, but exposure to a scripting language (Perl, Python, Ruby, and so on) will make the syntax easier to
follow. You don't need any specific integrated development environment (IDE) or tool knowledge. Familiarity with a text editor and setting environment variables is required.
System requirements
To run the examples in this tutorial, you must have a system capable of running the JVM. The tutorial assumes that
your Java environment is successfully configured, so download and install the JVM before continuing with this tutorial. At this time, you need to be able to run Subversion from
the command line to complete the ActiveRecord portion of the tutorial. Download a Subversion client (see the Resources section for links) before continuing with this
tutorial if you wish to perform the ActiveRecord examples.
Duration
Under 2 hours
Formats html, pdf
|  | |  |