You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-user@db.apache.org by Daniel Perry <d....@netcase.co.uk> on 2004/01/26 19:02:39 UTC
HSQLDB -> MySQL 4 transition
I have an application that I need to move from OJB to MySQL 4, and I have a
couple of questions.
1. Can I (with any necessary SQL compatibility changes) just use the same
SQL I used to create the hsqldb database to create the MYSQL database? or
should I regenerate the SQL for the core tables? I am not worried about
transferring data from HSQLDB.
2. Are there any 'features' I should be aware of ?
3. I need to migrate some data to OJB from another MySQL database. What's
the easiest method of doing this whilst respecting OJB's IDs etc? i.e., OJB
objects all have unique IDs. Should I write a simple java prog to transfer
the data?
Thanks for any thoughts.
Daniel.
---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org
Re: HSQLDB -> MySQL 4 transition
Posted by Gus Heck <gu...@olin.edu>.
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:gus.heck@olin.edu]
>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: ojb-user-unsubscribe@db.apache.org
>For additional commands, e-mail: ojb-user-help@db.apache.org
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
>For additional commands, e-mail: ojb-user-help@db.apache.org
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org
RE: HSQLDB -> MySQL 4 transition
Posted by Daniel Perry <d....@netcase.co.uk>.
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:gus.heck@olin.edu]
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: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org
Re: HSQLDB -> MySQL 4 transition
Posted by Gus Heck <gu...@olin.edu>.
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: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org