"Kelvin Cookshaw" <[EMAIL PROTECTED]> writes:
> 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'm doing basically the same thing. I'm essentially "replicating" a
database from Oracle to MySQL. I've made my MySQL database be exactly
the same as the Oracle one which makes things easy as I can use the
same classes to save the data. My repository_database.xml looks like:
<jdbc-connection-descriptor
jcd-alias="default"
default-connection="true"
platform="MySQL"
protocol="jdbc"
subprotocol="mysql"
driver="com.mysql.jdbc.Driver"
jdbc-level="3.0"
dbalias="//host/db"
username="username"
password="password"
batch-mode="false"
useAutoCommit="0"
ignoreAutoCommitExceptions="false"
/>
<jdbc-connection-descriptor
jcd-alias="oraclecv"
default-connection="false"
protocol="jdbc"
subprotocol="oracle"
platform="Oracle"
driver="oracle.jdbc.driver.OracleDriver"
jdbc-level="2.0"
dbalias="thin:@host:1521:db"
username="username"
password="password"
batch-mode="false"
useAutoCommit="0"
ignoreAutoCommitExceptions="false"
/>
I then do:
PBKey key = new PBKey("oraclecv");
PersistenceBroker oracle = PersistenceBrokerFactory.createPersistenceBroker(key);
PersistenceBroker mysql = PersistenceBrokerFactory.defaultPersistenceBroker();
Query query = new QueryByCriteria(CktOrder.class, null);
Iterator iter = oracle.getIteratorByQuery(query);
while (iter.hasNext()) {
CktOrder ckt = (CktOrder) iter.next();
oracle.clearCache();
mysql.clearCache();
mysql.store(ckt);
}
I'm not sure which one (if any) clearCache() I could get rid of as
this really isn't a time sensitive operation.
Hope that helps.
cdh
--
Chris D. Halverson http://www.halverson.org/
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]