My application must retrieve data from a Sybase database, and store data in
an Oracle database.  I don't know how or if this can be done.  I'm on 0.9.9,
currently.

I looked at putting the tables of both databases in the same
repository_user.xml, since I can specify more than one
jdbc-connection-descriptor, it seemed like I should be able to access tables
from each.  However, it doesn't seem like there are any hooks in the
class-descriptor tag to say which tables use which connections.

I tried to load a different repository.xml than the one specified in
OJB.properties, which would allow me to have two brokers: the default and an
extra.  This is what I tried:

return PersistenceBrokerFactory.createPersistenceBroker(
           "/path/repository_extra.xml", "user", "pwd");

with and without the user and password paramters set to null.

the xml includes a class-descriptor and:
<jdbc-connection-descriptor
    default-connection="true"
    jcd-alias="mysource"
    platform="Sybase"
    jdbc-level="2.0"
    driver="com.sybase.jdbc2.jdbc.SybDriver"
    protocol="jdbc"
    subprotocol="sybase"
    dbalias="Tds:host:5020/DEVT"
    username="user"
    password="pwd"
>
    <connection-pool
        maxActive="3"
        validationQuery="" />
    <sequence-manager
className="org.apache.ojb.broker.util.sequence.SequenceManagerHighLowImpl">
        <attribute attribute-name="grabSize" attribute-value="2"/>
    </sequence-manager>
</jdbc-connection-descriptor>

The Exception I got was:

java.lang.reflect.InvocationTargetException
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
        at java.lang.reflect.Constructor.newInstance(Unknown Source)
        at org.apache.ojb.broker.util.ClassHelper.newInstance(Unknown Source)
        at
org.apache.ojb.broker.util.factory.ConfigurableFactory.createNewInstance(UnknownSource)
        at
org.apache.ojb.broker.util.factory.ConfigurableFactory.createNewInstance(UnknownSource)
        at
org.apache.ojb.broker.accesslayer.ConnectionManagerFactory.createConnectionManager(UnknownSource)
        at org.apache.ojb.broker.singlevm.PersistenceBrokerImpl.<init>(Unknown
        Source) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native 
Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
        at java.lang.reflect.Constructor.newInstance(Unknown Source)
        at org.apache.ojb.broker.util.ClassHelper.newInstance(Unknown Source)
        at
org.apache.ojb.broker.ta.PersistenceBrokerFactoryDefaultImpl.createNewBrokerInstance(UnknownSource)
        at
org.apache.ojb.broker.ta.PersistenceBrokerFactoryDefaultImpl$PBKeyedPoolableObjectFactory.makeObject(UnknownSource)
        at
org.apache.commons.pool.impl.GenericKeyedObjectPool.borrowObject(GenericKeyedObjectPool.java:760)
       at
org.apache.ojb.broker.ta.PersistenceBrokerFactoryDefaultImpl.createPersistenceBroker(UnknownSource)
        at
org.apache.ojb.broker.ta.PersistenceBrokerFactoryDefaultImpl.createPersistenceBroker(UnknownSource)
        at
org.apache.ojb.broker.PersistenceBrokerFactory.createPersistenceBroker(UnknownSource)
        at
ca.tcpl.pipeops.dop.adapter.LoaderAdapter.getSeehawkBroker(LoaderAdapter.java:58)      
 at
ca.tcpl.pipeops.dop.adapter.LoaderAdapterTest.testGetMeasurements(LoaderAdapterTest.java:76)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at junit.framework.TestCase.runTest(TestCase.java:154)
        at junit.framework.TestCase.runBare(TestCase.java:127)
        at junit.framework.TestResult$1.protect(TestResult.java:106)
        at junit.framework.TestResult.runProtected(TestResult.java:124)
        at junit.framework.TestResult.run(TestResult.java:109)
        at junit.framework.TestCase.run(TestCase.java:118)
        at junit.framework.TestSuite.runTest(TestSuite.java:208)
        at junit.framework.TestSuite.run(TestSuite.java:203)
        at junit.swingui.TestRunner$16.run(TestRunner.java:625)
Caused by: java.lang.NullPointerException
        at org.apache.ojb.broker.platforms.PlatformFactory.getPlatformFor(Unknown
Source)
        at org.apache.ojb.broker.accesslayer.ConnectionManagerImpl.<init>(Unknown
Source)
        ... 35 more


Any hints on how to access multiple databases, multiple platforms? Or what
the above exception is caused by?

Thanks,
Kelvin




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to