In my ant build I have the following:

(in an init target:)

 <property file="build.properties"/>
 <property file="${profile}.properties"/>

(in the compile target: )

   <copy todir="${build.home}/WEB-INF">
     <fileset dir="web-inf-stuff">
       <include name="**/repository*.xml"/>
     </fileset>
     <filterset>
       <filter token="JCD_ALIAS" value="${jcdAlias}" />
       <filter token="DBMS_NAME" value="${dbmsName}" />
       <filter token="JDBC_LEVEL" value="${jdbcLevel}" />
       <filter token="DRIVER_NAME" value="${jdbcRuntimeDriver}" />
       <filter token="URL_PROTOCOL" value="${urlProtocol}" />
       <filter token="URL_SUBPROTOCOL" value="${urlSubprotocol}" />
       <filter token="URL_DBALIAS" value="${urlDbalias}" />
       <filter token="USER_NAME" value="${databaseUser}" />
       <filter token="USER_PASSWD" value="${databasePassword}" />
     </filterset>
   </copy>

So, if you have a similar setup, I beleive it should be a matter of editing build.properties to use the mysql.properties profile (it's in the ojb distro somewhere) and then customizing the mysql.properties. With a little work you could probably even set it up so that you could build for either database by simply invoking another target, or using ant command line option to set the profile property (-Dprofile="fooprofile").

As for getting the tables into mysql, I don't know what system you used with HSQLDB, but what I currently do is use Xdoclet and the <torqueschema> task to generate an xml descriptor, which I then feed to some jakarta commons-sql code to generate any needed create or alter statements for tables or table changes that show up in the xml descriptor on the fly as I develop new classes. It is working for me but I have my objects are simple and commons-sql is a sandbox codebase, so YMMV.

A more generic aproach is to generate the torque schema and then I bleive that there is a ant task for pusing torque schemas into your chosen db, (somewhere in the torque or ojb stuff).

I think torque will also generate an SQL DDL file for you which you could then push into your db by whatever means you find convenient. Or you can just create the tables by hand if there arn't too many and they arn't going to change :).

Importing data from another database is something that I'll let the experts to explain. :)

- Gus

Daniel Perry wrote:

Sorry for not being clear.
I have a system I have developed using OJB and HSQLDB.
I am keeping the system as-is, but am also producing a copy for someone
else.
Their system needs to use MySQL rather than HSQLDB.  I need to directly
transfer the repository and database tables (no data).
I also need to import some data from an existing MySQL database.
So it's pretty much "switching which database OJB uses".

Thanks,
Daniel.

-----Original Message-----
From: Gus Heck [mailto:[EMAIL PROTECTED]
Sent: 27 January 2004 00:49
To: OJB Users List
Subject: Re: HSQLDB -> MySQL 4 transition


Daniel Perry wrote:




I have an application that I need to move from OJB to MySQL 4, and I have a
couple of questions.





You can use OJB to interface with MySQL (Which is what I am doing right
now via the JDO API).

Do you mean moving to a non-OJB system, or do you mean switching which
database OJB uses?

-Gus


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



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






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



Reply via email to