Re: Easily Import/Export tables

From: open.pumpkin (open.pumpki..mail.com)
Date: Wed Sep 09 2009 - 02:49:09 EDT

  • Next message: gilbertoca: "Re: cayenne.xml not found"

    > Which version of Cayenne do you have?
    I use 2.0.4.
    I'll try to test with 3.0.

    > it's trivial to write ant tasks to export and import data
    I agree.
    I'm writing a java class to generate dynamic dumps (sql script) of my
    tables.
    It's not so longer I thought.

    Thanks for help !

    2009/9/8 Mike Kienenberger <mkienen..mail.com>

    > As an alternative:
    >
    > I find it far easier to use DBUnit to export and import data in a
    > database-independent format. If you use Eclipse, you can install the
    > QuantumDB plugin and export/import directly from eclipse (for small
    > tables).
    >
    > Otherwise, it's trivial to write ant tasks to export and import data.
    >
    > <target name="export" description="Copies all global table data to
    > XML files" depends="">
    > <dbunit
    > driver="oracle.jdbc.driver.OracleDriver"
    > classpath="${Oracle.lib}"
    > url="${jdbc.url}"
    > schema="schema"
    > userid="user"
    > password="password">
    >
    > <export dest="./data/dbunit/schema/TABLE1.xml"
    > format="flat">
    > <query name="SCHEMA.TABLE1" sql="SELECT * FROM
    > SCHEMA.TABLE1
    > ORDER BY ID"/>
    > </export>
    > <export dest="./data/dbunit/schema/TABLE2.xml"
    > format="flat">
    > <query name="SCHEMA.TABLE2" sql="SELECT * FROM
    > SCHEMA.TABLE2
    > ORDER BY ID"/>
    > </export>
    > </dbunit>
    > </target>
    >
    >
    > <target name="import" description="Recreates global tables in
    > Oracle from XML files" depends="">
    > <dbunit
    > driver="oracle.jdbc.driver.OracleDriver"
    > classpath="${Oracle.lib}"
    > url="${jdbc.url}"
    > schema="schema"
    > userid="user"
    > password="password">
    > <operation type="CLEAN_INSERT"
    > src="./data/dbunit/schema/TABLE1.xml" "/>
    > <operation type="CLEAN_INSERT"
    > src="./data/dbunit/schema/TABLE2.xml" "/>
    > </dbunit>
    > </target>
    >
    > On Mon, Sep 7, 2009 at 5:07 AM, open.pumpkin<open.pumpki..mail.com>
    > wrote:
    > > Hello,
    > >
    > > Is it possible to export tables using a dedicated cayenne function ?
    > >
    > > I would like to export one or more tables (and data), specified by the
    > user
    > > of my application, to import them in another environment (for example
    > from
    > > development to production).
    > >
    > > The ideal thing would be a SQL script generated by cayenne, independant
    > of
    > > databases and cayenne (I could use it with Mysql query browser, for
    > > example).
    > >
    > > Else, using serialization of cayenne objects ?
    > > Or another possibility ?
    > >
    > > The interest is to not manually write SELECT and UPDATE statements.
    > >
    > > Thanx.
    > > O.P.
    > >
    >



    This archive was generated by hypermail 2.0.0 : Wed Sep 09 2009 - 02:49:46 EDT