Here is a simple JRuby program to connect to an AS400 via JDBC using jt400.jar. Two strings are passed to the AS400 stored procedure (RPG program) and it capitalizes the letters in the string and returns the capitalized values. The code for the RPG and the SQL stored procedure code called from this JRuby program are in another example, here.
To see the unrendered JSON in a web page, direct your browser to http://localhost:4567/capitalize?first=xxx&last=yyy where xxx and yyy are two values of your choosing.