 |
Forums |
Admin Start New Thread
By: Nicholas Aronne
DB2 & Type-2 Connections with jRuby [ reply ] 2010-04-02 14:22
|
My colleague and I were able to get jRuby to run using DB2 type-2 connections with the native C library.
For anyone else who has been attempting to do so, I have provided our solution.
1. Catalog your DB2 database
e.g.
Database alias = MULTIDB
Database name = MULTIDB
Node name = PRODDB2
Database release level = c.00
Comment =
Directory entry type = Remote
Catalog database partition number = -1
Alternate server hostname = <hostname>
Alternate server port number = 50002
2. Enable DB2
e.g.
. /home/multicli/sqllib/db2dprofile
3. Export environment variables
e.g.
// This will ensure that we are using the DB2 32-bit native libraries
export LD_LIBRARY_PATH=/home/multicli/sqllib/lib32
// The next two exports gives the path to your instances SQLLIB and LIB paths, same as you would do in Ruby.
export IBM_DB_DIR=/home/multicli/sqllib
export IBM_DB_LIB=/home/multicli/sqllib/lib
4. Configure the database.yml
e.g.
// This is a snippet from ours, we specify using the JDBC adapter the name of our local database catalog, in this case MULTIDB (as we cataloged back in step 1).
development:
adapter: jdbc
username: user
password: pass
driver: com.ibm.db2.jcc.DB2Driver
url: jdbc:db2:MULTIDB
pool: 5
timeout: 5000
And there you have it, you will be able to use a type two connection with jRuby and this removes the dependency of IBM_DB.
|
|
 |