Warning: I know zero about Java :-)
I am trying to connect (read only) to an IBM Cloudscape database. This is what eventually became Derby. I have a list of jar files:
db2j.jar
db2jcc.jar
db2jcview.jar
db2jnet.jar
db2jtools.jar
that a real Java application uses to access the same database. The database is in a local directory like:
find db -type f -print | head -20
db/OpcClientDb/db.lck
db/OpcClientDb/dbex.lck
db/OpcClientDb/log/log.ctrl
db/OpcClientDb/log/log48978.dat
db/OpcClientDb/log/logmirror.ctrl
db/OpcClientDb/seg0/A1
db/OpcClientDb/seg0/c10.dat
db/OpcClientDb/seg0/c101.dat
db/OpcClientDb/seg0/c111.dat
db/OpcClientDb/seg0/c121.dat
db/OpcClientDb/seg0/c130.dat
db/OpcClientDb/seg0/c141.dat
db/OpcClientDb/seg0/c150.dat
...
Poking at the internet so far I've some up with this:
====
#! /usr/bin/env jruby
include Java
require 'lib/db2j.jar'
require 'lib/db2jcc.jar'
require 'lib/db2jcview.jar'
require 'lib/db2jnet.jar'
require 'lib/db2jtools.jar'
url = 'jdbc:db2j:db/OpcClientDb'
conn = java.sql.DriverManager.get_connection(url)
====
which gets me:
DriverManager.java:602:in `getConnection': java.sql.SQLException: No suitable driver found for jdbc:db2j:db/OpcClientDb
(plus a stack trace)
So I am guessing that I need to load the classes in the jar files but I can't figure out how to do that. I've tried things like:
import "com.ibm.db2j"
or
include_class java::db2j
or
java_import java.lang.com.ibm.db2j
all of which don't seem to be even close to what I need.
If I do:
jar tf lib/db2j.jar | head -20
I get things like:
com/ibm/db2j/aggregates/AggregateDefinition.class
com/ibm/db2j/aggregates/Aggregator.class
com/ibm/db2j/authentication/UserAuthenticator.class
com/ibm/db2j/catalog/AliasInfo.class
com/ibm/db2j/catalog/DefaultInfo.class
com/ibm/db2j/catalog/DependableFinder.class
com/ibm/db2j/catalog/IndexDescriptor.class
com/ibm/db2j/catalog/ReferencedColumns.class
com/ibm/db2j/catalog/Statistics.class
com/ibm/db2j/catalog/TypeDescriptor.class
com/ibm/db2j/core/BootStrap.class
How do I figure out what to pass to import or java_import or include?
Thank you for your time,
Perry
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email