On Sun, Mar 30, 2003 at 06:22:07PM -0500, Michael Harrison wrote:
> When I want to use OJB to connect to my own production db, do I need to
> run the build again, against a new build.xml file; or is it already set
No, you don't need to run the build again.
> up to use MySQL, and I only have to alter a few configuration files for
> the new jdbc url, password, etc?
I could get it run in standalone-mode by having the following xml files
in a directory (the program's home):
repository.xml
repository_database.xml
repository_internal.xml
repository_user.xml
The contents of repository.xml, are basically:
<descriptor-repository version="1.0" isolation-level="read-uncommitted">
&database;
&internal;
&user;
</descriptor-repository>
> The file repository_database.xml contains a jdbc-connection-descriptor
> with attributes like jcd-alias="@JCD_ALIAS@" I'm not familiar with
> @foo@ notation--does this mean there is supposed to be a
> previously-defined value for some JCD_ALIAS token or entity? Or is this
> a placeholder that I should replace with real values?
You can change it to "default":
<!-- this connection was used as the default one within OJB -->
<jdbc-connection-descriptor
jcd-alias="default"
default-connection="true"
platform="MySQL"
jdbc-level="2.0"
...
Later, you can get that default connection by
PersistenceBroker broker =
PersistenceBrokerFactory.defaultPersistenceBroker();
To have the repository.xml getting read, make sure that your program's
home is set to the directory where that repository resides. This can be
done via ant:
<target name="execute" depends="compile" description="execute the
app">
<exec dir="${ojbhome}" executable="${javahome}/bin/java">
<arg line="-classpath
${distdir}:${commons-beanutils-jar}:${commons-collections-jar}:${commons-dbcp-jar}:${commons-lang-jar}:${commons-logging-jar}:${commons-pool-jar}:${ojb-jar}:${spy-jar}:${xerces-jar}:${j2ee-jar}"/>
<arg line="com.<your main package>.Main"/>
</exec>
</target>
Somewhere above, ojbhome was set to the program's home dir.
> Also, what is the relationship between the repository_database.xml file
> and the values I set in mysql.profile before the build?
It would provide you with a connection defined in the file.
> Is the build supposed to write this XML file out?
Yes; overwriting it, I mean.
Oki
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]